Skip to main content

Testing

npm test # vitest run
npm run test:watch # vitest
npx vitest run src/features/contacts
RunnerVitest 5, configured in vite.config.ts
Environmentjsdom, setup in src/test/setup.ts (jest-dom matchers)
Filessrc/**/*.test.{ts,tsx} (64 at last count), for example src/api/client.test.ts, src/features/contacts/*.test.tsx
Fixturessrc/test/me.ts (a /rest/crm/me/ payload with capabilities and scope)

What to test​

  • Capability gating: a route or button is hidden without the capability and shown with it (render with a me fixture).
  • API functions in features/<area>/api.ts: path, method, trailing slash, query encoding; mock fetch.
  • Form validation and 400/409 handling, since those bodies drive the UI.
  • The dev send guard.

What not to do​

  • Do not hit the real backend from tests; mock at fetch.
  • Do not put real names, emails or addresses in fixtures.

CI does not run the suite yet (the develop workflow only builds and deploys); run it before opening a pull request. Adding a npm test step to the workflow is on the known gaps list.