tests ready

This commit is contained in:
2026-02-19 13:33:20 +03:00
parent c8b84b7bd7
commit 2c820e103a
17 changed files with 2618 additions and 65 deletions

View File

@@ -494,19 +494,71 @@ All implementation tasks MUST follow the Design-by-Contract specifications:
---
## Phase 10: Unit Tests (Co-located per Fractal Strategy)
**Purpose**: Create unit tests for all implemented components following the Fractal Co-location strategy
**Contract Requirements**:
- All unit tests MUST be in `__tests__` subdirectories relative to the code they verify
- Use `unittest.mock.MagicMock` for heavy dependencies (DB sessions, Auth)
- Tests MUST include `@RELATION: VERIFIES -> [TargetComponent]`
### Frontend Stores Tests
- [x] T070 [P] [US1] Create unit tests for `sidebar.js` in `frontend/src/lib/stores/__tests__/test_sidebar.js`
_Contract: @RELATION: VERIFIES -> frontend/src/lib/stores/sidebar.js_
_Test: Test initial state, toggleSidebar, setActiveItem, setMobileOpen, localStorage persistence_
- [x] T071 [P] [US2] Create unit tests for `taskDrawer.js` in `frontend/src/lib/stores/__tests__/test_taskDrawer.js`
_Contract: @RELATION: VERIFIES -> frontend/src/lib/stores/taskDrawer.js_
_Test: Test openDrawer, closeDrawer, updateResourceTask, getTaskForResource_
- [x] T072 [P] [US2] Create unit tests for `activity.js` in `frontend/src/lib/stores/__tests__/test_activity.js`
_Contract: @RELATION: VERIFIES -> frontend/src/lib/stores/activity.js_
_Test: Test activeCount calculation, recentTasks derivation_
### Backend API Routes Tests
- [x] T073 [P] [US3] Create unit tests for `dashboards.py` in `backend/src/api/routes/__tests__/test_dashboards.py`
_Contract: @RELATION: VERIFIES -> backend/src/api/routes/dashboards.py_
_Test: Test GET /api/dashboards, POST /migrate, POST /backup, pagination, search filter_
- [x] T074 [P] [US4] Create unit tests for `datasets.py` in `backend/src/api/routes/__tests__/test_datasets.py`
_Contract: @RELATION: VERIFIES -> backend/src/api/routes/datasets.py_
_Test: Test GET /api/datasets, POST /map-columns, POST /generate-docs, pagination_
### Backend Services Tests
- [x] T075 [P] [US3] Create unit tests for `resource_service.py` in `backend/src/services/__tests__/test_resource_service.py`
_Contract: @RELATION: VERIFIES -> backend/src/services/resource_service.py_
_Test: Test get_dashboards_with_status, get_datasets_with_status, get_activity_summary, _get_git_status_for_dashboard_
### Frontend Components Tests
- [x] T076 [P] [US1] Create unit tests for `Sidebar.svelte` component in `frontend/src/lib/components/layout/__tests__/test_sidebar.svelte.js`
_Contract: @RELATION: VERIFIES -> frontend/src/lib/components/layout/Sidebar.svelte_
_Test: Test sidebar store integration, UX states (Expanded/Collapsed/Mobile), navigation, localStorage persistence_
- [x] T077 [P] [US2] Create unit tests for `TaskDrawer.svelte` component in `frontend/src/lib/components/layout/__tests__/test_taskDrawer.svelte.js`
_Contract: @RELATION: VERIFIES -> frontend/src/lib/components/layout/TaskDrawer.svelte_
_Test: Test task drawer store, UX states (Closed/Open), resource-task mapping, WebSocket integration_
- [x] T078 [P] [US5] Create unit tests for `TopNavbar.svelte` component in `frontend/src/lib/components/layout/__tests__/test_topNavbar.svelte.js`
_Contract: @RELATION: VERIFIES -> frontend/src/lib/components/layout/TopNavbar.svelte_
_Test: Test sidebar store integration, activity store integration, task drawer integration, UX states_
**Checkpoint**: Unit tests created for all core components
---
## Summary
| Metric | Value |
|--------|-------|
| Total Tasks | 85 |
| Total Tasks | 94 |
| Setup Tasks | 5 |
| Foundational Tasks | 6 |
| US1 (Sidebar) Tasks | 6 |
| US2 (Task Drawer) Tasks | 8 |
| US5 (Top Navbar) Tasks | 5 |
| US3 (Dashboard Hub) Tasks | 21 |
| US4 (Dataset Hub) Tasks | 17 |
| US1 (Sidebar) Tasks | 8 |
| US2 (Task Drawer) Tasks | 10 |
| US5 (Top Navbar) Tasks | 6 |
| US3 (Dashboard Hub) Tasks | 23 |
| US4 (Dataset Hub) Tasks | 18 |
| US6 (Settings) Tasks | 8 |
| Polish Tasks | 7 |
| Parallel Opportunities | 20+ |
| Unit Tests Tasks | 9 |
| MVP Scope | Phases 1-5 (25 tasks) |