93 test files read a single frontend source and asserted identifiers in it. The
MapWorkspace split showed what that costs: 24 tests went red for a move that
changed no behaviour at all. A contract belongs to the feature — a container,
its hooks, its domain layer — not to whichever file currently holds it.
232 read sites now resolve through read_feature(). The distinction that makes
this safe is direction: a *positive* contract ("this is wired") may widen,
because the identifier must still exist somewhere in the feature; a *negative*
one ("this component performs no transport") is a statement about one file, and
widening it would quietly weaken the check. The 73 single-file reads that
remain are exactly those, and a guard now enforces the rule for new tests.
Verified rather than assumed: of the 732 migrated positive assertions, 644 still
match exactly one module — as specific as before — and the other 86 already
spanned a container and its hook by nature. Two apparent misses are an artefact
of the checking regex reading an escaped newline literally.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
75 lines
2.9 KiB
Python
75 lines
2.9 KiB
Python
from pathlib import Path
|
|
from tests.frontend_contract import read_feature
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_source_portfolio_covers_the_complete_platform() -> None:
|
|
portfolio = (ROOT / "frontend/src/lib/sourcePortfolio.ts").read_text(encoding="utf-8")
|
|
|
|
for domain in ("space", "nature", "soil", "mobility", "people", "climate"):
|
|
assert f"key: '{domain}'" in portfolio
|
|
|
|
for source in (
|
|
"Landgebruik Vlaanderen",
|
|
"Digitale bodemkaart",
|
|
"Bedrijventerreinen OSLO",
|
|
"Knooppuntwaarde per hectare",
|
|
"Statistische sectoren",
|
|
"Inwonersdichtheid per hectare",
|
|
"Totaal voorzieningenniveau",
|
|
"Hitte-eilanden in steden",
|
|
"Luchtkwaliteit",
|
|
"Vlaamse Hydrografische Atlas",
|
|
):
|
|
assert source in portfolio
|
|
|
|
assert portfolio.count("domain: 'climate'") < portfolio.count("domain:") / 2
|
|
assert "OFFICIAL_SOURCE_PORTFOLIO" in portfolio
|
|
assert "dataset.status === 'ready'" in portfolio
|
|
|
|
|
|
def test_source_inventory_is_compact_honest_and_domain_driven() -> None:
|
|
catalog = read_feature("datasets")
|
|
styles = (ROOT / "frontend/src/styles/app.css").read_text(encoding="utf-8")
|
|
|
|
assert "Welke vragen kan GeoIntel beantwoorden?" in catalog
|
|
assert "Zes domeinen vormen samen het platform" in catalog
|
|
assert "operationalSources(ready)" in catalog
|
|
assert "Dekking per kaartthema en tijdreeks" in catalog
|
|
assert "Actieve broncollecties en hun beperkingen" in catalog
|
|
assert "Officiële bronnen die hierna kunnen worden ingeladen" in catalog
|
|
assert "Meetbaar als:" in catalog
|
|
assert "source-domain-grid" in styles
|
|
assert "source-opportunity-domain" in styles
|
|
assert "section.source-catalog-panel > .panel-title-row" in styles
|
|
assert "display: grid !important" in styles
|
|
assert "justify-self: start" in styles
|
|
|
|
|
|
def test_roadmap_prioritizes_cross_domain_profile_before_more_water_layers() -> None:
|
|
roadmap = (ROOT / "docs/DATAVINDPLAATS_SOURCE_ROADMAP.md").read_text(encoding="utf-8")
|
|
|
|
assert "Water is one analysis domain" in roadmap
|
|
assert "Wave 1 - Cross-domain area profile" in roadmap
|
|
assert "space occupation 2025" in roadmap
|
|
assert "population density 2019" in roadmap
|
|
assert "node value 2022" in roadmap
|
|
assert "total service level 2022" in roadmap
|
|
assert "digital soil map" in roadmap
|
|
assert "VHA/runoff as hydrological context" in roadmap
|
|
assert "Governed Flemish Thematic Raster Registry - Wave 1" in roadmap
|
|
|
|
|
|
def test_portfolio_pass_does_not_add_provider_fetch_or_persistence_code() -> None:
|
|
changed_scope = {
|
|
"frontend/src/lib/sourcePortfolio.ts",
|
|
"frontend/src/components/datasets/SourceCatalogPanel.tsx",
|
|
"frontend/src/styles/app.css",
|
|
"docs/DATAVINDPLAATS_SOURCE_ROADMAP.md",
|
|
}
|
|
|
|
assert not any(path.startswith("backend/app/") for path in changed_scope)
|
|
assert not any("migration" in path for path in changed_scope)
|