Add component tests for P3.11 (82 tests across 5 files)

- DecisionCard tests: 11 tests covering rendering, status icons, styling
- DataPanel tests: 18 tests covering biometrics display, null handling, styling
- NutritionPanel tests: 12 tests covering seeds, carbs, keto guidance display
- OverrideToggles tests: 18 tests covering toggle states, callbacks, styling
- DayCell tests: 23 tests covering phase coloring, today highlighting, click handling

Total tests now: 707 passing across 40 test files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-11 09:02:34 +00:00
parent 39198fdf8c
commit 267d45f98a
6 changed files with 874 additions and 23 deletions

View File

@@ -4,7 +4,7 @@ This file is maintained by Ralph. Run `./ralph-sandbox.sh plan 3` to generate ta
## Current State Summary
### Overall Status: 625 tests passing across 35 test files
### Overall Status: 707 tests passing across 40 test files
### Library Implementation
| File | Status | Gap Analysis |
@@ -110,12 +110,12 @@ This file is maintained by Ralph. Run `./ralph-sandbox.sh plan 3` to generate ta
| `src/app/calendar/page.test.tsx` | **EXISTS** - 23 tests (rendering, navigation, ICS subscription, token regeneration) |
| `src/app/settings/page.test.tsx` | **EXISTS** - 24+ tests (form rendering, validation, submission) |
| `src/app/settings/garmin/page.test.tsx` | **EXISTS** - 27 tests (connection status, token management) |
| `src/components/dashboard/decision-card.test.tsx` | **MISSING** - Needs tests for rendering, status icons |
| `src/components/dashboard/data-panel.test.tsx` | **MISSING** - Needs tests for biometrics display |
| `src/components/dashboard/nutrition-panel.test.tsx` | **MISSING** - Needs tests for nutrition guidance display |
| `src/components/dashboard/override-toggles.test.tsx` | **MISSING** - Needs tests for toggle state and callbacks |
| `src/components/dashboard/decision-card.test.tsx` | **EXISTS** - 11 tests (rendering, status icons, styling) |
| `src/components/dashboard/data-panel.test.tsx` | **EXISTS** - 18 tests (biometrics display, null handling, styling) |
| `src/components/dashboard/nutrition-panel.test.tsx` | **EXISTS** - 12 tests (seeds, carbs, keto guidance) |
| `src/components/dashboard/override-toggles.test.tsx` | **EXISTS** - 18 tests (toggle states, callbacks, styling) |
| `src/components/dashboard/mini-calendar.test.tsx` | **EXISTS** - 23 tests (calendar grid, phase colors, navigation, legend) |
| `src/components/calendar/day-cell.test.tsx` | **MISSING** - Needs tests for phase coloring, click handler |
| `src/components/calendar/day-cell.test.tsx` | **EXISTS** - 23 tests (phase coloring, today highlighting, click handling) |
| `src/app/plan/page.test.tsx` | **EXISTS** - 16 tests (loading states, error handling, phase display, exercise reference, rebounding techniques) |
| E2E tests | **AUTHORIZED SKIP** - Per specs/testing.md |
@@ -665,20 +665,21 @@ Testing, error handling, and refinements.
- **Why:** Confidence in production deployment
- **Status:** Per specs/testing.md: "End-to-end tests are not required for MVP (authorized skip)"
### P3.11: Missing Component Tests
- [ ] Add unit tests for untested components
- **Components Needing Tests (5 total):**
- `src/components/dashboard/decision-card.tsx` - Tests for rendering decision status, icon, and reason
- `src/components/dashboard/data-panel.tsx` - Tests for biometrics display (BB, HRV, intensity)
- `src/components/dashboard/nutrition-panel.tsx` - Tests for seeds, carbs, keto guidance display
- `src/components/dashboard/override-toggles.tsx` - Tests for toggle states and callbacks (has interactive state)
- `src/components/calendar/day-cell.tsx` - Tests for phase coloring and click handler
- **Test Files to Create:**
- `src/components/dashboard/decision-card.test.tsx`
- `src/components/dashboard/data-panel.test.tsx`
- `src/components/dashboard/nutrition-panel.test.tsx`
- `src/components/dashboard/override-toggles.test.tsx`
- `src/components/calendar/day-cell.test.tsx`
### P3.11: Missing Component Tests ✅ COMPLETE
- [x] Add unit tests for untested components
- **Components Tested (5 total):**
- `src/components/dashboard/decision-card.tsx` - 11 tests for rendering decision status, icon, reason, styling
- `src/components/dashboard/data-panel.tsx` - 18 tests for biometrics display (BB, HRV, intensity), null handling, styling
- `src/components/dashboard/nutrition-panel.tsx` - 12 tests for seeds, carbs, keto guidance display
- `src/components/dashboard/override-toggles.tsx` - 18 tests for toggle states, callbacks, styling
- `src/components/calendar/day-cell.tsx` - 23 tests for phase coloring, today highlighting, click handling
- **Test Files Created:**
- `src/components/dashboard/decision-card.test.tsx` - 11 tests
- `src/components/dashboard/data-panel.test.tsx` - 18 tests
- `src/components/dashboard/nutrition-panel.test.tsx` - 12 tests
- `src/components/dashboard/override-toggles.test.tsx` - 18 tests
- `src/components/calendar/day-cell.test.tsx` - 23 tests
- **Total Tests Added:** 82 tests across 5 files
- **Why:** Component isolation ensures UI correctness and prevents regressions
---
@@ -797,7 +798,6 @@ P4.* UX Polish ────────> After core functionality complete
| Priority | Task | Effort | Notes |
|----------|------|--------|-------|
| Medium | P2.18 OIDC Auth | Large | Production auth requirement |
| Medium | P3.11 Component Tests | Medium | 5 components need tests |
| Low | P3.7 Error Handling | Small | Polish |
| Low | P3.8 Loading States | Small | Polish |
| Low | P4.* UX Polish | Various | After core complete |
@@ -812,7 +812,6 @@ P4.* UX Polish ────────> After core functionality complete
| P0.4 | P0.1, P0.2 | P1.7, P2.9, P2.10, P2.13 |
| P2.18 | P1.6 | - |
| P3.9 | P2.4 | - |
| P3.11 | - | - |
---
@@ -880,6 +879,7 @@ P4.* UX Polish ────────> After core functionality complete
- [x] **P3.5: Encryption Tests** - Complete with 14 tests covering AES-256-GCM round-trip, error handling, key validation
- [x] **P3.6: Garmin Tests** - Complete with 33 tests covering API interactions, token expiry, error handling
- [x] **P3.9: Token Expiration Warnings** - Complete with 10 new tests in email.test.ts, 10 new tests in garmin-sync/route.test.ts; sends warnings at 14 and 7 days before expiry
- [x] **P3.11: Missing Component Tests** - Complete with 82 tests across 5 component test files (DecisionCard: 11, DataPanel: 18, NutritionPanel: 12, OverrideToggles: 18, DayCell: 23)
---
@@ -912,4 +912,4 @@ P4.* UX Polish ────────> After core functionality complete
13. **OIDC vs Email/Password:** Current email/password login (P1.6) works for development. P2.18 upgrades to OIDC for production security per specs/authentication.md
14. **E2E Tests:** Authorized skip per specs/testing.md - unit and integration tests are sufficient for MVP
15. **Dark Mode:** Partial Tailwind support exists via dark: classes but may need prefers-color-scheme configuration in tailwind.config.js (see P4.3)
16. **Component Tests:** 5 components lack unit tests (P3.11) - DecisionCard, DataPanel, NutritionPanel, OverrideToggles, DayCell
16. **Component Tests:** P3.11 COMPLETE - All 5 dashboard and calendar components now have comprehensive unit tests (82 tests total)