from pathlib import Path ROOT = Path(__file__).resolve().parents[2] def read(path: str) -> str: return (ROOT / path).read_text(encoding="utf-8") def test_regional_workspace_is_automatic_and_map_has_one_scope_selector() -> None: project_hook = read("frontend/src/hooks/useProjectWorkspace.ts") map_workspace = read("frontend/src/components/map/MapWorkspace.tsx") regional_check = project_hook.index("const regionalProject") municipality_check = project_hook.index("const municipalityProject") assert regional_check < municipality_check assert 'aria-label="Regio"' not in map_workspace assert 'aria-label="Ingeladen regiobereik"' in map_workspace assert "Gemeente of volledige regio" in map_workspace assert 'aria-label="Werkgebied"' in map_workspace def test_primary_navigation_uses_end_user_language_and_keeps_management_secondary() -> None: app = read("frontend/src/App.tsx") for label in ("Kaart", "Bronnen", "Kwaliteit", "Beeldanalyse", "Downloads"): assert f"label: '{label}'" in app assert "{ label: 'Beheer', keys: ['overview', 'system'] }" in app assert 'className="secondary-analysis-disclosure segmentation-disclosure"' in app def test_technical_projects_and_metadata_are_progressively_disclosed() -> None: projects = read("frontend/src/components/project/ProjectPanel.tsx") areas = read("frontend/src/components/project/AreaPanel.tsx") datasets = read("frontend/src/components/datasets/DatasetPanel.tsx") assert "TECHNICAL_PROJECT_PATTERN" in projects assert "technische test- en benchmarkruns" in projects assert "area-catalog-disclosure" in areas assert "dataset-technical-details" in datasets assert "getDatasetDisplayName" in datasets def test_configured_yolo_and_active_asset_are_selected_without_hiding_limitations() -> None: hook = read("frontend/src/hooks/useDetectionWorkflow.ts") lab = read("frontend/src/components/detection/DetectionLab.tsx") assert "useState('yolo-configured')" in hook assert "useState(0.15)" in hook assert "asset.active" in hook assert "getYoloPreflight" in hook assert 'aria-label="Status gebouwdetectie"' in lab assert "resultaten blijven controleplichtig" in lab assert "Modelkalibratie voor beheerders" in lab