Skip to content

Commit af936c7

Browse files
committed
test(scripts): minimize feature metadata regression coverage
1 parent 737f758 commit af936c7

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

tests/test_timestamp_branches.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_json_output_keys(self, git_repo: Path):
106106
assert re.match(r"^\d{8}-\d{6}$", data["FEATURE_NUM"])
107107

108108
def test_writes_feature_metadata_file(self, git_repo: Path):
109-
"""The create script persists .specify/feature.json for downstream commands."""
109+
"""Feature creation persists .specify/feature.json with the created spec dir."""
110110
import json
111111

112112
result = run_script(git_repo, "--json", "--short-name", "meta-test", "Metadata test")
@@ -450,6 +450,12 @@ def test_powershell_supports_allow_existing_branch_flag(self):
450450
# Ensure the flag is referenced in script logic, not just declared
451451
assert "AllowExistingBranch" in contents.replace("-AllowExistingBranch", "")
452452

453+
def test_powershell_persists_feature_metadata(self):
454+
"""Static guard: PS script writes .specify/feature.json."""
455+
contents = CREATE_FEATURE_PS.read_text(encoding="utf-8")
456+
assert "feature_directory = \"specs/$branchName\"" in contents
457+
assert "feature.json" in contents
458+
453459

454460
# ── Dry-Run Tests ────────────────────────────────────────────────────────────
455461

@@ -787,18 +793,3 @@ def test_ps_dry_run_json_absent_without_flag(self, ps_git_repo: Path):
787793
assert result.returncode == 0, result.stderr
788794
data = json.loads(result.stdout)
789795
assert "DRY_RUN" not in data, f"DRY_RUN should not be in normal JSON: {data}"
790-
791-
def test_ps_writes_feature_metadata_file(self, ps_git_repo: Path):
792-
"""PowerShell create script persists .specify/feature.json."""
793-
import json
794-
795-
result = run_ps_script(
796-
ps_git_repo, "-Json", "-ShortName", "ps-meta", "PowerShell metadata"
797-
)
798-
assert result.returncode == 0, result.stderr
799-
data = json.loads(result.stdout)
800-
801-
metadata_file = ps_git_repo / ".specify" / "feature.json"
802-
assert metadata_file.exists(), "feature metadata file was not created"
803-
metadata = json.loads(metadata_file.read_text(encoding="utf-8-sig"))
804-
assert metadata == {"feature_directory": f"specs/{data['BRANCH_NAME']}"}

0 commit comments

Comments
 (0)