testing-patterns
Installation
SKILL.md
Testing Patterns
Use this skill to choose the lightest effective test type and apply project-consistent patterns for Vitest unit tests, TRPC integration tests with PGlite, and Playwright E2E tests.
Test Hierarchy (prefer simpler first)
- Unit tests (preferred) - Cover pure functions, parsers, and Effect services.
- TRPC integration tests - Cover full TRPC + database behavior.
- E2E tests - Cover browser and full user flows.
When to Use Each
| Situation | Test Type | Action |
|---|---|---|
| Pure function, parser, util | Unit | Write immediately |
| Effect service with dependencies | Unit with mock layers | Write immediately |
| TRPC procedure (DB logic) | TRPC integration | Follow decision process |
| User-facing flow, UI behavior | E2E | Follow decision process |