"""The scenario catalogue covers every scenario in the spec (module.yaml tests.scenarios), and every one of them
passes in process: the whole composition, real ASGI and MCP, the business clock under control."""
import pathlib
import sys
from erp_platform.scenarios.cli import main
HERE = pathlib.Path(__file__).parent
sys.path.insert(0, str(HERE / "scenarios"))
import catalogue # noqa: E402
SPEC = ["SC-PJ-01", "SC-PJ-02", "SC-PJ-03", "SC-PJ-04", "SC-PJ-05", "SC-PJ-06", "SC-PJ-07"]
def test_the_catalogue_covers_the_spec():
ids = [sc.id for sc in catalogue.CAT.scenarios]
assert ids[:len(SPEC)] == SPEC and ids[len(SPEC):] == ["SC-PJ-08", "SC-PJ-09", "SC-PJ-10", "SC-PJ-11"]
def test_every_scenario_passes_in_process(monkeypatch, tmp_path):
from erp_platform import work
monkeypatch.setenv("PUBLIC_LINK_BASE_URL", "https://status.shop.example")
work.reset_clock()
report = tmp_path / "scenarios.md"
code = main(["run", str(HERE / "scenarios" / "catalogue.py"), "--markdown", str(report)])
assert code == 0, report.read_text() if report.exists() else "no report"