Skip to content

Commit df00038

Browse files
test: end-to-end wrap strategy coverage via self-test preset
1 parent 864c440 commit df00038

3 files changed

Lines changed: 53 additions & 1 deletion

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
description: "Self-test wrap command — pre/post around core"
3+
strategy: wrap
4+
---
5+
6+
## Preset Pre-Logic
7+
8+
preset:self-test wrap-pre
9+
10+
{CORE_TEMPLATE}
11+
12+
## Preset Post-Logic
13+
14+
preset:self-test wrap-post

presets/self-test/preset.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ provides:
5656
description: "Self-test override of the specify command"
5757
replaces: "speckit.specify"
5858

59+
- type: "command"
60+
name: "speckit.wrap-test"
61+
file: "commands/speckit.wrap-test.md"
62+
description: "Self-test wrap strategy command"
63+
5964
tags:
6065
- "testing"
6166
- "self-test"

tests/test_presets.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,7 @@ def test_self_test_manifest_valid(self):
16671667
assert manifest.id == "self-test"
16681668
assert manifest.name == "Self-Test Preset"
16691669
assert manifest.version == "1.0.0"
1670-
assert len(manifest.templates) == 7 # 6 templates + 1 command
1670+
assert len(manifest.templates) == 8 # 6 templates + 2 commands
16711671

16721672
def test_self_test_provides_all_core_templates(self):
16731673
"""Verify the self-test preset provides an override for every core template."""
@@ -3143,3 +3143,36 @@ def test_register_commands_substitutes_core_template_for_wrap_strategy(self, pro
31433143
assert "# Core Specify" in written
31443144
assert "## Pre" in written
31453145
assert "## Post" in written
3146+
3147+
def test_end_to_end_wrap_via_self_test_preset(self, project_dir):
3148+
"""Installing self-test preset with a wrap command substitutes {CORE_TEMPLATE}."""
3149+
from specify_cli.presets import PresetManager
3150+
3151+
# Install a core template that wrap-test will wrap around
3152+
core_dir = project_dir / ".specify" / "templates" / "commands"
3153+
core_dir.mkdir(parents=True, exist_ok=True)
3154+
(core_dir / "wrap-test.md").write_text(
3155+
"---\ndescription: core wrap-test\n---\n\n# Core Wrap-Test Body\n"
3156+
)
3157+
3158+
# Set up skills dir (simulating --ai claude)
3159+
skills_dir = project_dir / ".claude" / "skills"
3160+
skills_dir.mkdir(parents=True, exist_ok=True)
3161+
skill_subdir = skills_dir / "speckit-wrap-test"
3162+
skill_subdir.mkdir()
3163+
(skill_subdir / "SKILL.md").write_text("---\nname: speckit-wrap-test\n---\n\nold content\n")
3164+
3165+
# Write init-options so _register_skills finds the claude skills dir
3166+
import json
3167+
(project_dir / ".specify" / "init-options.json").write_text(
3168+
json.dumps({"ai": "claude", "ai_skills": True})
3169+
)
3170+
3171+
manager = PresetManager(project_dir)
3172+
manager.install_from_directory(SELF_TEST_PRESET_DIR, "0.1.5")
3173+
3174+
written = (skill_subdir / "SKILL.md").read_text()
3175+
assert "{CORE_TEMPLATE}" not in written
3176+
assert "# Core Wrap-Test Body" in written
3177+
assert "preset:self-test wrap-pre" in written
3178+
assert "preset:self-test wrap-post" in written

0 commit comments

Comments
 (0)