From 99d7c9a16de2b44f808f8315505c5f47eb1d44b5 Mon Sep 17 00:00:00 2001 From: ericnoam Date: Thu, 2 Apr 2026 16:43:29 +0200 Subject: [PATCH] test: derive expected commands from templates dynamically - Remove hard-coded command count (9) and command set from test_directory_structure - Use forge.list_command_templates() to derive expected commands - Test now auto-syncs when core command templates are added/removed - Prevents test breakage when template set changes - All 11 tests pass --- tests/integrations/test_integration_forge.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/integrations/test_integration_forge.py b/tests/integrations/test_integration_forge.py index 735fa232a..10905723f 100644 --- a/tests/integrations/test_integration_forge.py +++ b/tests/integrations/test_integration_forge.py @@ -89,12 +89,16 @@ class TestForgeIntegration: forge.setup(tmp_path, m) commands_dir = tmp_path / ".forge" / "commands" assert commands_dir.is_dir() + + # Derive expected command names from the Forge command templates so the test + # stays in sync if templates are added/removed. + templates = forge.list_command_templates() + expected_commands = {t.stem for t in templates} + assert len(expected_commands) > 0, "No command templates found" + + # Check generated files match templates command_files = sorted(commands_dir.glob("speckit.*.md")) - assert len(command_files) == 9 - expected_commands = { - "analyze", "checklist", "clarify", "constitution", - "implement", "plan", "specify", "tasks", "taskstoissues", - } + assert len(command_files) == len(expected_commands) actual_commands = {f.name.removeprefix("speckit.").removesuffix(".md") for f in command_files} assert actual_commands == expected_commands