--- phase: 04-review-download-security plan: 01 subsystem: testing tags: [vitest, tdd, react-testing-library, red-baseline] # Dependency graph requires: - phase: 03-wizard-ui provides: WizardProvider, WizardState, useWizard hook — required for rendering ReviewStep in tests - phase: 02-generators provides: buildRcloneConf, buildIntuneInstall, buildIntuneDetection, buildRmmScript — called in ReviewStep provides: - RED baseline test stubs for CONF-02, CONF-03, DOWN-01–DOWN-06, SECU-01, SECU-02 - GREEN SECU-03 assertion in reducer.test.ts confirming no storage writes affects: [04-02-plan, 04-03-plan, 04-04-plan, 04-05-plan] # Tech tracking tech-stack: added: [] patterns: - "Wave 0 TDD stubs use expect.fail('not yet implemented') for named RED failures" - "Requirement IDs embedded in describe block names (CONF-02, DOWN-01, etc.) for traceability" - "Storage.prototype.setItem spied via vi.spyOn for SECU-03 coverage" - "vi.mock at file level for downloadFile and downloadZip modules" - "vi.stubGlobal for navigator.clipboard and URL in beforeEach" key-files: created: - src/components/wizard/ReviewStep.test.tsx modified: - src/store/reducer.test.ts key-decisions: - "[04-01] Wave 0 stubs use expect.fail — named RED baseline, not import-error RED, for all 10 ReviewStep requirements" - "[04-01] renderWithState helper wraps with WizardProvider (no initialState prop) — actual state injection deferred to GREEN phase" - "[04-01] SECU-03 goes in reducer.test.ts not ReviewStep.test.tsx — reducer is the state boundary that must never touch storage" patterns-established: - "Pattern: Phase 4 test files include @vitest-environment jsdom directive at top" requirements-completed: [CONF-02, CONF-03, DOWN-01, DOWN-02, DOWN-03, DOWN-04, DOWN-05, DOWN-06, SECU-01, SECU-02, SECU-03] # Metrics duration: 2min completed: 2026-03-27 --- # Phase 4 Plan 01: TDD Wave 0 RED Baseline for Review & Download Summary **10 named RED stubs covering all ReviewStep requirements (CONF-02/03, DOWN-01–06, SECU-01/02) plus GREEN SECU-03 storage-isolation assertion in reducer tests** ## Performance - **Duration:** 2 min - **Started:** 2026-03-27T09:39:00Z - **Completed:** 2026-03-27T09:41:00Z - **Tasks:** 2 - **Files modified:** 2 ## Accomplishments - Created ReviewStep.test.tsx with 10 describe/it blocks — one per requirement behavior, all failing RED with named stubs - Added vi to reducer.test.ts and SECU-03 assertion verifying Storage.prototype.setItem is never called across all reducer action types - Full test suite: 11 passing test files, 1 failing (ReviewStep — expected Wave 0 state) ## Task Commits Each task was committed atomically: 1. **Task 1: Write ReviewStep.test.tsx with RED stubs** - `db4c80f` (test) 2. **Task 2: Add SECU-03 assertion to reducer.test.ts** - `f428630` (test) **Plan metadata:** (docs commit — next) _Note: TDD Wave 0 plan — all commits are test-only RED baselines_ ## Files Created/Modified - `src/components/wizard/ReviewStep.test.tsx` - 10 named RED stubs for Phase 4 requirements; vi.mock for downloadFile/downloadZip; vi.stubGlobal for clipboard and URL - `src/store/reducer.test.ts` - Added `vi` import and SECU-03 test verifying setItem never called across all reducer actions ## Decisions Made - Wave 0 stubs use `expect.fail('not yet implemented')` for named RED failures rather than relying on import errors — consistent with Phase 3 established pattern - `renderWithState` helper uses plain `WizardProvider` (no initialState prop) since WizardProvider does not support initial state injection; actual pre-populated state rendering is deferred to the GREEN implementation phase - SECU-03 assertion placed in reducer.test.ts rather than ReviewStep.test.tsx because the reducer is the state boundary that must never touch storage — the component is irrelevant to this invariant ## Deviations from Plan None - plan executed exactly as written. ## Issues Encountered None. ## User Setup Required None - no external service configuration required. ## Next Phase Readiness - Wave 0 RED baseline established for all 11 requirement IDs (CONF-02/03, DOWN-01–06, SECU-01/02/03) - reducer.test.ts SECU-03 GREEN — confirms storage isolation contract holds before any new code is written - Ready for Phase 4 Plan 02: implement ReviewStep component (GREEN phase for all stubs) --- *Phase: 04-review-download-security* *Completed: 2026-03-27*