DocsTesting
Run the Vitest suite and individual tests
Testing
Tests use Vitest with a jsdom environment and Testing Library.
Run the suite
npm test # watch mode
npm run test:run # single run (CI)
Config lives in vitest.config.js: environment: 'jsdom', globals: true, setup file ./src/__tests__/setup.js (which imports @testing-library/jest-dom), and an @ -> ./src alias.
Run a single test
# A single file
npx vitest run src/__tests__/lib/permissions.test.js
# Filter by test name
npx vitest run -t "seat limit"
# Watch one file
npx vitest src/__tests__/lib/permissions.test.js
What's covered
The suite (~30 files) covers:
- API routes (
src/__tests__/api/): auth callback/signup, billing subscribe, clips store, frameio import, invite, notifications send, opponents, orgs members, season report POST, sessions coaching, sessions store, stripe webhook, student-coaches, video sign, wsl scrape. - Top-level: middleware, modal helper, stream-token, video stream.
- Libraries (
src/__tests__/lib/): athlete providers, conditions, entitlements, email templates, permissions, qualifications, spots, surfline.
A helpers/mockSupabase.js provides a Supabase mock for route tests.