48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_app_uses_shared_orchestration_hooks() -> None:
|
|
app = (ROOT / "frontend" / "src" / "App.tsx").read_text(encoding="utf-8")
|
|
|
|
assert "useProviderCapabilities" in app
|
|
assert "useChangeDetectionWorkflow" in app
|
|
assert "useMapWorkspaceState" in app
|
|
assert "from './hooks/useProviderCapabilities'" in app
|
|
assert "from './hooks/useChangeDetectionWorkflow'" in app
|
|
assert "from './hooks/useMapWorkspaceState'" in app
|
|
assert "analysisApi" not in app
|
|
assert "externalApi" not in app
|
|
|
|
|
|
def test_provider_capabilities_hook_owns_provider_api_calls() -> None:
|
|
hook = (ROOT / "frontend" / "src" / "hooks" / "useProviderCapabilities.ts").read_text(encoding="utf-8")
|
|
|
|
assert "externalApi.listProviders" in hook
|
|
assert "loadCapabilities" in hook
|
|
assert "loadingCapabilities" in hook
|
|
assert "capabilitiesError" in hook
|
|
|
|
|
|
def test_change_detection_hook_owns_change_detection_api_calls() -> None:
|
|
hook = (ROOT / "frontend" / "src" / "hooks" / "useChangeDetectionWorkflow.ts").read_text(encoding="utf-8")
|
|
|
|
assert "analysisApi.runChangeDetection" in hook
|
|
assert "runChangeDetection" in hook
|
|
assert "changeDetectionResult" in hook
|
|
assert "loadDatasetJobs" in hook
|
|
|
|
|
|
def test_map_workspace_state_hook_owns_derived_map_state() -> None:
|
|
hook = (ROOT / "frontend" / "src" / "hooks" / "useMapWorkspaceState.ts").read_text(encoding="utf-8")
|
|
|
|
assert "areaFeatureCollection" in hook
|
|
assert "mapFeatureCollection" in hook
|
|
assert "mapLayerLabel" in hook
|
|
assert "setSelectedMapFeature(null)" in hook
|
|
|