from erp_platform import work
from conftest import headers
from seed import hire_body, seed
HR = headers("hr_admin")
TICK = headers("clock")
def test_a_hire_makes_a_person_and_a_run(engine, api, drafter):
work.set_clock(at=work.parse_instant("2026-10-19T10:00 Europe/London"), freeze=True)
seed(lambda p, b: api("POST", p, HR, b))
s, out = api("POST", "/hires", HR, hire_body("Anna", "Berg", "2026-11-02"))
assert s == 200, out
s, run = api("GET", f"/runs/{out['run_id']}", HR)
assert s == 200, run
assert run["steps_total"] > 5
s, t = api("POST", "/run-due-steps", TICK, {})
assert s == 200, t
def test_the_docs_name_the_platform_and_the_scenarios_the_code_has():
"""AGENTS.md said erp-platform 0.5.x and the README SC-HR-01..28 while pyproject pins 0.8.x and the catalogue
runs to SC-HR-31: an agent reading the docs would install the wrong platform. The docs follow the code."""
import pathlib
import re
root = pathlib.Path(__file__).resolve().parents[1]
pin = re.search(r'"erp-platform>=(\d+)\.(\d+)', (root / "pyproject.toml").read_text())
assert f"**erp-platform** ({pin[1]}.{pin[2]}.x" in (root / "AGENTS.md").read_text()
last = max(int(n) for n in re.findall(r'@CAT\.scenario\("SC-HR-(\d+)"', (root / "tests/scenarios/catalogue.py").read_text()))
assert f"SC-HR-01..{last:02d}" in (root / "README.md").read_text()