| name | testing |
| description | Guidance for backend pytest strategies, frontend Vitest testing, API contract validation, and edge case coverage. |
Testing Skill Directive
1. **Backend Testing (`pytest`)**: Write tests in `backend/tests/`. Cover API routes, authentication workflows, service logic, and database operations using test fixtures.
2. **Frontend Testing (`Vitest`)**: Write unit and component tests in `frontend/tests/`. Cover Pinia stores, composables, and component rendering.
3. **API Contract Validation**: Verify backend response models match frontend TypeScript interfaces.
4. **Edge Case Coverage**: Test invalid inputs, missing fields, unauthorized requests, expired tokens, and boundary conditions.
5. **Failure-First Coverage (Default)**: Every endpoint/route must include at least one failure-case (negative) test in addition to the happy path — invalid payloads (→ 422), missing/non-existent resources (→ 404), unauthorized/forbidden (→ 401/403), and duplicate or conflicting inputs (→ 409/422). Do not ship happy-path-only suites unless the user explicitly requests it.
6. **Prove Tests Run**: After writing tests, confirm they are discovered and executed with a nonzero collected count (e.g. "5 passed"). A suite that collects zero tests, or a runner reported as "not configured" or skipped, is NOT a pass — surface it to the user instead of claiming success.
7. **No Test Suppression**: Never comment out failing assertions or delete tests to force a green build.