The Vitest suite and its three tripwire tests
Testing
Tests use Vitest with jsdom and Testing Library. The suite is 119 files / 1,223 tests and runs in about 7 seconds.
npm test # watch mode
npm run test:run # single run (CI)
npx vitest run src/__tests__/lib/permissions.test.js # one file
npx vitest run -t "seat limit" # by name
Config is in vitest.config.js: environment: 'jsdom', globals: true, setup file src/__tests__/setup.js (imports @testing-library/jest-dom), an @ → ./src alias, the forks pool (tolerates spaces in paths) and an exclusion of @sentry/server-utils from the transform pipeline — remove either of the last two and the suite breaks.
Three tripwires
src/__tests__/api/auth-coverage.test.jswalks every API route and fails if one lacks an auth signal, unless it is allow-listed with a written justification.src/__tests__/lib/permission-catalog-consumers.test.jsfails if a permission key insrc/lib/roles.jsis checked by nothing that ships, or if the labels, seeded roles, trim migration, seed script or the Roles & Permissions docs page drift from the catalog.src/__tests__/lib/notification-catalog-emitters.test.jsfails if a notification type has no live emitter (app code or a database trigger whose table still exists), or if a seeded type is missing from the catalog.
What is covered
API routes (src/__tests__/api/), the middleware, the SurfVision helper and stream tokens, and the libraries (src/__tests__/lib/): permissions and roles, modules, notifications, billing math, wearable derivations and binding, review rules, messaging rules, age rules, competition freshness and strategy. helpers/mockSupabase.js provides a Supabase mock for route tests.
The Apple repo has its own suite (187 tests on the SurflinkCompanion scheme) that pins the wire models shared with the web.