"""Smoke tests for WP-0015-T07: every real `specs/policies/`/ `specs/profiles/` file must actually render without error. No database or Docker required — this only exercises `reference_docs.py`'s pure file-rendering logic. """ from __future__ import annotations import pytest from conftest import REPO_ROOT pytest.importorskip("markdown") pytest.importorskip("yaml") from target_revenue.service import reference_docs # noqa: E402 POLICY_SLUGS = ["linear-longstop-v0"] PROFILE_SLUGS = [ "development-license", "cost-plus-operations", "phase-sponsorship", "service-with-development-allocation", "product-ideation", "general-consulting", ] def test_all_real_policy_files_exist_on_disk(): for slug in POLICY_SLUGS: assert (REPO_ROOT / "specs" / "policies" / f"{slug}.md").is_file() def test_all_real_profile_files_exist_on_disk(): for slug in PROFILE_SLUGS: assert (REPO_ROOT / "specs" / "profiles" / f"{slug}.md").is_file() @pytest.mark.parametrize("slug", POLICY_SLUGS) def test_policy_doc_renders_without_error(slug): result = reference_docs.load_reference_doc("policies", slug) assert result is not None html, frontmatter = result assert "

" in html or "

" in html assert "policy_id" in frontmatter assert frontmatter["policy_id"].startswith("trsl:policy:") @pytest.mark.parametrize("slug", PROFILE_SLUGS) def test_profile_doc_renders_without_error(slug): result = reference_docs.load_reference_doc("profiles", slug) assert result is not None html, frontmatter = result assert "

" in html assert "extension_id" in frontmatter assert frontmatter["extension_id"].startswith("trsl:extension:") def test_unknown_kind_returns_none(): assert reference_docs.load_reference_doc("calculators", "anything") is None def test_unknown_slug_returns_none(): assert reference_docs.load_reference_doc("policies", "does-not-exist") is None def test_policy_slug_from_id(): assert reference_docs.policy_slug_from_id("trsl:policy:linear-longstop-v0@1.0") == "linear-longstop-v0" def test_extension_slug_from_id(): assert reference_docs.extension_slug_from_id("trsl:extension:development-license@1.0") == "development-license"