| name | tdd-frontend |
| description | Implement a Next.js component or page using TDD with Jest, React Testing Library, and Playwright for PlaylistMiner frontend. |
TDD Feature Implementation (Next.js)
Implement the requested component or page using TDD.
Step 1: Write Jest Test
- Create test file alongside the component:
ComponentName.test.tsx
- Use React Testing Library:
render, screen, userEvent
- Test rendering, user interactions, edge cases
- Run
npm test in src/web/ — confirm tests FAIL
Step 2: Implement Component
- Write minimal component to pass tests
- TypeScript strict — no
any types
- Use TanStack Query for API calls via custom hooks in
hooks/
- Tailwind CSS only — no custom CSS
- Server components by default,
"use client" only for interactivity
- Run
npm test — confirm tests PASS
Step 3: E2E Test (for pages)
- Add Playwright test in
src/web/e2e/ for the user flow
- Test the happy path end-to-end
- Run
npm run test:e2e
Rules
- API calls go through hooks, never directly in components
- All hooks use the auto-generated OpenAPI client
- Check dark mode rendering
- Check responsive layout at mobile width