state-hub/tests/test_validate_repo_adr.py

37 lines
809 B
Python
Raw Normal View History

from __future__ import annotations
from scripts.validate_repo_adr import Report, _check_workplan_file
def test_repository_qualified_ad_hoc_id_matches_daily_filename(tmp_path) -> None:
workplans = tmp_path / "workplans"
workplans.mkdir()
path = workplans / "ADHOC-2026-08-23.md"
path.write_text(
"""---
id: ACTIVITY-WP-ADHOC-2026-08-23
type: workplan
title: Daily repair
domain: infotech
status: finished
owner: codex
created: "2026-08-23"
---
## Repair
```task
id: ACTIVITY-WP-ADHOC-2026-08-23-T01
status: done
priority: low
```
""",
encoding="utf-8",
)
report = Report(repo_path=str(tmp_path))
_check_workplan_file(path, report)
assert not report.failures
assert not [finding for finding in report.warnings if finding.check == "filename-id-prefix"]