Match the proof to the risk.
Coverage Heuristics
- Unit test pure helpers, mappers, schemas, policies, and use-cases.
- Integration test route handlers, repository adapters, server actions, and feature loaders.
- UI test reusable interactive components with meaningful state transitions.
- E2E test critical journeys: auth, checkout, submit flows, dashboard success paths.
Refactor Rule
- Before substantial cleanup or architecture change, lock existing behavior with the smallest effective regression coverage.
- If behavior is not easy to automate, record a deterministic manual verification checklist.
Completion Checklist
- Relevant lint/type/test commands run successfully.
- Edge cases for loading, empty, error, and success states are verified.
- Route handlers and server actions verify both happy path and known failures.