Quality

Testing

Running the backend and Storybook tests yourself, and where to add a test.

Run it locally

CommandWhat it runs
yarn testThe backend suite
yarn storybook:testStorybook play tests. Start Storybook first
yarn lintoxlint and syncpack
yarn formatPrettier, as a check. yarn format:fix writes
yarn a11yThe accessibility sweep. See Accessibility
yarn security:semgrepThe Semgrep rules. See Security

Backend tests

The backend suite runs against a real Postgres, started fresh by Testcontainers for each run. It also needs RustFS running, so start the dev stack first.

Put a test beside the file it tests, as name.test.ts. Use createTestUser and contextFor to call a procedure as a given role. There's a full example in Adding a procedure.

Test files run one at a time. Each test resets the database first, so they can't run side by side.

Storybook

Every shared-ui component and every web-app page has stories, covering loading, empty, error, and read-only states. API calls are mocked with MSW, from handlers typed against the real router.

yarn storybook:dev

Add a story beside the component, as Name.stories.tsx. Use a play() function to reach a state that needs a click.

  • CI/CD — what runs on a pull request.
  • Tooling — why Vitest, Storybook, and MSW.