Vitest unit test suite — 228 tests.
- Runner:
bun run test:unit - Config:
vitest.config.mjs - Structure:
test/unit/
| Directory | Description |
|---|---|
test/unit/api/ |
oRPC API routes (user, fruit, basket CRUD, CSRF, cache) |
test/unit/auth/ |
Auth callbacks, middleware, email templates, security notifications |
test/unit/actions/ |
Server actions (contact, email sending) |
Tests mock Prisma client and auth context:
vi.mock("@lib/prisma")— mock database callsvi.mock("@lib/auth")— mock authenticated sessionvi.mock("@lib/activity")— mock activity logging- Each test calls the function directly and asserts the response
100% coverage on api/**/*.ts and actions/**/*.ts (excludes lib/, client files, infra).