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>
54 lines
2.5 KiB
Python
54 lines
2.5 KiB
Python
from pathlib import Path
|
|
from tests.frontend_contract import read_map_workspace, read_feature
|
|
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_map_uses_road_basemap_with_attribution_and_env_override() -> None:
|
|
geo_map = (REPO_ROOT / "frontend/src/components/GeoMap.tsx").read_text(encoding="utf-8")
|
|
env_example = (REPO_ROOT / ".env.example").read_text(encoding="utf-8")
|
|
|
|
assert "DEFAULT_ROAD_BASEMAP_STYLE" in geo_map
|
|
assert "https://tile.openstreetmap.org/{z}/{x}/{y}.png" in geo_map
|
|
assert "OpenStreetMap contributors" in geo_map
|
|
assert "VITE_MAP_STYLE_URL" in geo_map
|
|
assert "AttributionControl" in geo_map
|
|
assert "VITE_MAP_STYLE_URL=" in env_example
|
|
assert "https://demotiles.maplibre.org/style.json" not in env_example
|
|
assert "managed MapLibre style URL" in env_example
|
|
|
|
|
|
def test_map_workspace_can_select_persisted_database_layer_and_run_query() -> None:
|
|
map_workspace = read_map_workspace()
|
|
app_shell = read_feature("shell")
|
|
styles = (REPO_ROOT / "frontend/src/styles/app.css").read_text(encoding="utf-8")
|
|
|
|
assert "map-database-layer-select" in map_workspace
|
|
assert "Kies een bewaarde vectorlaag" in map_workspace
|
|
assert "Gebruik van de kaartondergrond" in map_workspace
|
|
assert "VITE_MAP_STYLE_URL" in map_workspace
|
|
assert "Operationele GIS-controle" in map_workspace
|
|
assert "Begeleide operationele GIS-werkstroom" in map_workspace
|
|
assert "Bewaarde databankobjecten" in map_workspace
|
|
assert "Werkgebied of laag doorzoeken" in map_workspace
|
|
assert "Resultaatlaag bewaren" in map_workspace
|
|
assert "GeoJSON-download bewaren" in map_workspace
|
|
assert "Kwaliteit controleren" in map_workspace
|
|
assert "Volledige GIS-werkstroom uitvoeren" in map_workspace
|
|
assert "runFullGisWorkflow" in map_workspace
|
|
assert "fullWorkflowStatus" in map_workspace
|
|
assert "Selecteren, bewaren, controleren en downloaden" in map_workspace
|
|
assert "fullWorkflowMode" in map_workspace
|
|
assert "Nieuwe resultaatlaag en download maken" in map_workspace
|
|
assert "Laatste resultaatlaag opnieuw controleren" in map_workspace
|
|
assert "Het laatste bewaarde resultaat is opnieuw gebruikt en gecontroleerd." in map_workspace
|
|
assert "latestSelectionDataset" in map_workspace
|
|
assert "selectedMapDatasetId=" in app_shell
|
|
assert ".basemap-policy-notice" in styles
|
|
assert ".guided-gis-flow" in styles
|
|
assert ".guided-gis-batch-status" in styles
|
|
assert ".guided-gis-run-mode" in styles
|
|
assert ".gis-test-run-surface" in styles
|
|
assert ".gis-test-run-grid" in styles
|