Files
geointel/backend/tests/test_sprint51_quality_export_polish.py
T
JensandClaude Opus 5 6572e4ad5f scope frontend contracts to the feature, not to one file
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>
2026-08-22 22:05:43 +02:00

49 lines
2.2 KiB
Python

from pathlib import Path
from tests.frontend_contract import read_feature
ROOT = Path(__file__).resolve().parents[2]
def test_quality_panel_uses_workbench_summary_and_cards() -> None:
quality_panel = (
ROOT / "frontend" / "src" / "components" / "quality" / "QualityResultsPanel.tsx"
).read_text(encoding="utf-8")
assert "'quality-results-panel quality-results-panel-empty' : 'quality-results-panel'" in quality_panel
assert 'className="quality-summary-grid"' in quality_panel
assert 'className="quality-check-list"' in quality_panel
assert 'className="quality-check-card"' in quality_panel
assert "Nog geen bewaarde kwaliteitsresultaten" in quality_panel
assert "check.metrics.map" in quality_panel
assert "fetch(" not in quality_panel
def test_export_center_uses_artifact_actions_and_cards() -> None:
export_center = read_feature("exports")
export_preview = (ROOT / "frontend" / "src" / "components" / "exports" / "ExportPreview.tsx").read_text(
encoding="utf-8"
)
assert 'className="export-center"' in export_center
assert 'className="export-action-grid"' in export_center
assert 'className="latest-export-card"' in export_center
assert 'className="export-history-controls"' in export_center
assert 'className="export-list"' in export_center
assert 'className="export-card"' in export_center
assert "exportTypeFilter" in export_center
assert "exportStatusFilter" in export_center
assert "exportSearchQuery" in export_center
assert "exportMatchesSearch" in export_center
assert "filteredExports = useMemo" in export_center
assert "visibleExports = showAllExports ? filteredExports : filteredExports.slice(0, 10)" in export_center
assert "Geen downloads passen bij deze filters." in export_center
assert "Filters wissen" in export_center
assert "Toon alle downloads" in export_center
assert "onExportDataset" in export_center
assert "onExportDetectionRun" in export_center
assert "onExportSegmentationRun" in export_center
assert "HTML alleen downloaden" in export_center
assert 'className="export-preview-panel"' in export_preview
assert "Nog geen bestand gekozen." in export_preview