From 54228961f764bdede1c1b9477a5b9ecbbe17b4bb Mon Sep 17 00:00:00 2001 From: CoderDeltaLAN Date: Sat, 20 Jun 2026 19:41:14 +0100 Subject: [PATCH] test: add dedupe golden output contract --- tests/test_golden_outputs.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/test_golden_outputs.py b/tests/test_golden_outputs.py index c4f7f94..5dd2b23 100644 --- a/tests/test_golden_outputs.py +++ b/tests/test_golden_outputs.py @@ -218,6 +218,37 @@ def test_budget_single_agent_fixture_matches_golden_output(self) -> None: "Next step: review large instruction files before adding more agent guidance.\n", ) + def test_dedupe_duplicate_fixture_matches_golden_output(self) -> None: + with tempfile.TemporaryDirectory() as tmp_dir: + repository = Path(tmp_dir) + duplicate = "Run unit tests before opening a pull request." + (repository / "AGENTS.md").write_text( + f"# Agent instructions\n\n- {duplicate}\n", + encoding="utf-8", + ) + (repository / "CLAUDE.md").write_text( + f"# Claude instructions\n\n{duplicate}\n", + encoding="utf-8", + ) + + result = run_cli(["dedupe", str(repository)]) + + self.assertEqual(result.exit_code, 0) + self.assertEqual(result.stderr, "") + self.assertEqual( + result.stdout, + f"agent-rules-kit dedupe: {repository}\n" + "Status: review\n" + "Supported instruction files: 2\n" + "Duplicate groups: 1\n" + "Duplicate lines: 2\n" + "Duplicate groups:\n" + "1. - Run unit tests before opening a pull request.\n" + " - AGENTS.md:3\n" + " - CLAUDE.md:3\n" + "Next step: move repeated instructions into one source of truth or import path.\n", + ) + def test_explain_known_rule_matches_golden_output(self) -> None: result = run_cli(["explain", "AIRK-GOV003"])