Extract workbench bootstrap hook
This commit is contained in:
@@ -14,11 +14,13 @@ def test_app_uses_shared_orchestration_hooks() -> None:
|
||||
assert "useProviderCapabilities" in app
|
||||
assert "useChangeDetectionWorkflow" in app
|
||||
assert "useMapWorkspaceState" in app
|
||||
assert "useWorkbenchBootstrap" in app
|
||||
assert "from './hooks/useProjectWorkspace'" in app
|
||||
assert "from './hooks/useDemoWorkflow'" in app
|
||||
assert "from './hooks/useProviderCapabilities'" in app
|
||||
assert "from './hooks/useChangeDetectionWorkflow'" in app
|
||||
assert "from './hooks/useMapWorkspaceState'" in app
|
||||
assert "from './hooks/useWorkbenchBootstrap'" in app
|
||||
assert "projectsApi" not in app
|
||||
assert "areasApi" not in app
|
||||
assert "datasetsApi" not in app
|
||||
@@ -33,8 +35,9 @@ def test_app_entrypoint_has_clean_encoding_and_react_imports() -> None:
|
||||
app = app_path.read_text(encoding="utf-8")
|
||||
|
||||
assert not app_bytes.startswith(b"\xef\xbb\xbf")
|
||||
assert "import { useEffect, useMemo } from 'react'" in app
|
||||
assert "import { useMemo } from 'react'" in app
|
||||
assert "FormEvent" not in app
|
||||
assert "useEffect" not in app
|
||||
assert "useState" not in app
|
||||
|
||||
|
||||
@@ -52,6 +55,24 @@ def test_demo_workflow_hook_owns_demo_api_and_cross_module_selection() -> None:
|
||||
assert "loadDatasetDetails(result.project_id, candidateDataset)" in hook
|
||||
|
||||
|
||||
def test_workbench_bootstrap_hook_owns_entrypoint_effects() -> None:
|
||||
app = (ROOT / "frontend" / "src" / "App.tsx").read_text(encoding="utf-8")
|
||||
hook = (ROOT / "frontend" / "src" / "hooks" / "useWorkbenchBootstrap.ts").read_text(encoding="utf-8")
|
||||
|
||||
assert "loadProjects().catch(() => null)" not in app
|
||||
assert "loadDetectionResults().catch(() => null)" not in app
|
||||
assert "loadSegmentationResults().catch(() => null)" not in app
|
||||
assert "loadProjects().catch(() => null)" in hook
|
||||
assert "loadCapabilities().catch(() => null)" in hook
|
||||
assert "loadDetectionModels().catch(() => null)" in hook
|
||||
assert "loadSegmentationModels().catch(() => null)" in hook
|
||||
assert "resetProjectData()" in hook
|
||||
assert "resetDatasetForProject()" in hook
|
||||
assert "loadProjectData(selectedProjectId).catch(() => null)" in hook
|
||||
assert "loadDetectionResults().catch(() => null)" in hook
|
||||
assert "loadSegmentationResults().catch(() => null)" in hook
|
||||
|
||||
|
||||
def test_project_workspace_hook_owns_project_area_dataset_loading() -> None:
|
||||
hook = (ROOT / "frontend" / "src" / "hooks" / "useProjectWorkspace.ts").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user