Skip to content

Independent Auditing of AI Agents. Run by human or the agent itself, to answer the most crucial question in the AI Agent Economy. Is the agent doing what is supposed to do? With iFixAi you can have this answer in less than 120 seconds.

fix(cli): allow validating built-in fixture names in validate command (#227)

Alan Vo222096cd0c06
diff --git a/ifixai/cli/validate.py b/ifixai/cli/validate.py
index becf292..cf23d10 100644
--- a/ifixai/cli/validate.py
+++ b/ifixai/cli/validate.py
@@ -6,7 +6,7 @@ from ifixai.harness.validator import LayoutValidationError, validate_layout
@click.command()
[email protected]("path", type=click.Path(exists=True), required=False)
[email protected]("path", required=False)
def validate(path: str | None) -> None:
if path is None:
try:
diff --git a/ifixai/tests/test_cli_validate.py b/ifixai/tests/test_cli_validate.py
new file mode 100644
index 0000000..f5c1de3
--- /dev/null
+++ b/ifixai/tests/test_cli_validate.py
@@ -0,0 +1,18 @@
+from click.testing import CliRunner
+
+from ifixai.cli.main import ifixai_cli
+
+
+def test_cli_validate_builtin_fixture_name():
+ runner = CliRunner()
+ result = runner.invoke(ifixai_cli, ["validate", "default"])
+ assert result.exit_code == 0, result.output
+ assert "Valid" in result.output
+
+
+def test_cli_validate_nonexistent_fixture_reports_error():
+ runner = CliRunner()
+ result = runner.invoke(ifixai_cli, ["validate", "nonexistent_fixture_name"])
+ assert result.exit_code == 1, result.output
+ assert "Validation failed with 1 error(s):" in result.output
+ assert "Fixture not found: 'nonexistent_fixture_name'" in result.output