# Implementation Plan: Fix Tests and Playground Components ## Goal 1. Fix the malformed `SleepTimetable.test.tsx`. 2. Resolve console errors in `WakeupPlot` and `BedtimePlot` playground components. 3. Ensure 100% test pass rate using TDD. ## Phase 1: Fix Malformed Test File - **Action:** Clean up `frontend/tests/unit/components/stats/SleepTimetable.test.tsx` by removing duplicated and malformed test blocks. - **Verification:** Run `npm run test` to ensure the parse error is resolved and existing tests pass. ## Phase 2: Fix Playground Components (`WakeupPlot`, `BedtimePlot`) - **Investigation:** - Examine `frontend/src/utils/time.js` to find the `split` error in `timeToMinutes`. - Trace calls from `frontend/src/components/stats/WakeupPlot.js` and `frontend/src/components/stats/BedtimePlot.js`. - **Resolution:** Fix the `undefined` value being passed to time utilities, ensuring components load in the playground without console errors. - **Verification:** Validate via component tests and ensure no regressions. ## Phase 3: Final TDD Verification - **Mandatory Loop:** 1. Run `npm run test`. 2. Run `npm run test:all`. - **Requirement:** Iterate until all tests pass flawlessly (100% success) and the component fixes are verified. No task is complete until both commands return zero errors.