docs(03-00): complete Wave 0 test stubs plan
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
---
|
||||
phase: 03-interaction-quality-and-completeness
|
||||
plan: 00
|
||||
subsystem: testing
|
||||
tags: [vitest, react-testing-library, typescript, react]
|
||||
|
||||
# Dependency graph
|
||||
requires: []
|
||||
provides:
|
||||
- BudgetSetup.test.tsx with smoke test and 2 it.skip stubs (IXTN-01)
|
||||
- CategoriesPage.test.tsx with smoke test and 4 it.skip stubs (IXTN-05, STATE-02)
|
||||
- DashboardPage.test.tsx with smoke test and 2 it.skip stubs (STATE-01, STATE-03)
|
||||
- BillsTracker.test.tsx with smoke test and 3 it.skip stubs (STATE-03, IXTN-03)
|
||||
affects:
|
||||
- 03-01 (spinner/disable tests for BudgetSetup, CategoriesPage)
|
||||
- 03-02 (empty state tests for DashboardPage, CategoriesPage)
|
||||
- 03-03 (skeleton/flash tests for BillsTracker)
|
||||
|
||||
# Tech tracking
|
||||
tech-stack:
|
||||
added: []
|
||||
patterns:
|
||||
- vi.mock('@/hooks/useBudgets') pattern for mocking hooks to control loading state in page tests
|
||||
- BudgetDetail minimal fixture pattern for component tests needing complex props
|
||||
- MemoryRouter wrapper for page-level components that use react-router-dom
|
||||
|
||||
key-files:
|
||||
created:
|
||||
- frontend/src/components/BudgetSetup.test.tsx
|
||||
- frontend/src/pages/CategoriesPage.test.tsx
|
||||
- frontend/src/pages/DashboardPage.test.tsx
|
||||
- frontend/src/components/BillsTracker.test.tsx
|
||||
modified: []
|
||||
|
||||
key-decisions:
|
||||
- "Mock useBudgets hook in DashboardPage tests rather than mocking the API to control loading state directly"
|
||||
- "BillsTracker renders a full Card component — wrap with div, not <tr>, in tests"
|
||||
- "DashboardPage already has an empty state component; smoke test asserts budget.create button presence instead of combobox"
|
||||
|
||||
patterns-established:
|
||||
- "Smoke test pattern: render with minimal props, assert one visible element to confirm no crash"
|
||||
- "Hook mock pattern: vi.mock('@/hooks/useName', () => ({ useName: () => ({ ...returnValues }) }))"
|
||||
- "i18n key passthrough: t: (key: string) => key gives predictable assertions like getByText('budget.create')"
|
||||
|
||||
requirements-completed: [IXTN-01, IXTN-05, STATE-01, STATE-02, STATE-03]
|
||||
|
||||
# Metrics
|
||||
duration: 5min
|
||||
completed: 2026-03-11
|
||||
---
|
||||
|
||||
# Phase 3 Plan 0: Wave 0 Test Stubs Summary
|
||||
|
||||
**4 vitest stub files created for BudgetSetup, CategoriesPage, DashboardPage, and BillsTracker — each with a passing smoke test and pending it.skip stubs covering IXTN-01/05 and STATE-01/02/03 behaviors**
|
||||
|
||||
## Performance
|
||||
|
||||
- **Duration:** ~5 min
|
||||
- **Started:** 2026-03-11T21:30:00Z
|
||||
- **Completed:** 2026-03-11T21:32:14Z
|
||||
- **Tasks:** 1
|
||||
- **Files modified:** 4
|
||||
|
||||
## Accomplishments
|
||||
|
||||
- Created Wave 0 test stubs satisfying Nyquist compliance for Plans 01-03
|
||||
- All 4 stub files load without errors; full test suite green (43 passing + 11 skipped)
|
||||
- Each stub file has at least one non-skipped passing smoke test plus multiple it.skip stubs documenting target behaviors
|
||||
- Discovered DashboardPage already has an empty state implementation (heading "No budgets yet" + CTA button)
|
||||
|
||||
## Task Commits
|
||||
|
||||
1. **Task 1: Create 4 test stub files with pending test cases** - `c95c7f2` (test)
|
||||
|
||||
## Files Created/Modified
|
||||
|
||||
- `frontend/src/components/BudgetSetup.test.tsx` - Smoke test + 2 it.skip for IXTN-01 (spinner, disable on save)
|
||||
- `frontend/src/pages/CategoriesPage.test.tsx` - Smoke test + 4 it.skip for IXTN-05 (confirm dialog, delete, error) and STATE-02 (empty state)
|
||||
- `frontend/src/pages/DashboardPage.test.tsx` - Smoke test + 2 it.skip for STATE-01 (empty state CTA) and STATE-03 (loading skeleton)
|
||||
- `frontend/src/components/BillsTracker.test.tsx` - Smoke test + 3 it.skip for STATE-03 (tinted skeleton) and IXTN-03 (row flash green/red)
|
||||
|
||||
## Decisions Made
|
||||
|
||||
- Mocked `@/hooks/useBudgets` in DashboardPage test to set `loading: false` directly, avoiding timing issues with async API calls
|
||||
- BillsTracker renders a full `<Card>` (not a table cell), so tests render it standalone rather than inside a `<tr>`
|
||||
- Used i18n key passthrough (`t: (key) => key`) enabling predictable text assertions with translation keys
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
None - plan executed exactly as written, with minor adjustments to smoke test assertions based on actual rendered output (DashboardPage empty state already existed — asserting `budget.create` button instead of combobox).
|
||||
|
||||
## Issues Encountered
|
||||
|
||||
- DashboardPage smoke test initially queried for `role="combobox"` which is absent when `list=[]` (the Select renders no trigger without items). Fixed by asserting the `budget.create` button instead, which is always present.
|
||||
- BillsTracker initially wrapped in `<tr>` (semantic mismatch since the component renders a Card div). Fixed by rendering standalone.
|
||||
|
||||
## User Setup Required
|
||||
|
||||
None - no external service configuration required.
|
||||
|
||||
## Next Phase Readiness
|
||||
|
||||
- All 4 test files exist and are vitest-runnable — Plans 01-03 can reference them in verify commands
|
||||
- Smoke tests confirm component renders without crashing with minimal props
|
||||
- it.skip stubs document exact behaviors to implement with their requirement IDs
|
||||
|
||||
---
|
||||
*Phase: 03-interaction-quality-and-completeness*
|
||||
*Completed: 2026-03-11*
|
||||
Reference in New Issue
Block a user