Skip to content

Frontend — Component Tests

This document describes the component and unit testing approach used by the frontend and points to the tests located in app/frontend/src/tests.

Goals

  • Verify individual React components (atoms, molecules) render correctly and behave as expected.
  • Catch regressions in UI behaviour, props handling and accessibility.
  • Keep tests fast and focused so they can run in CI.

Tools

  • Vitest: test runner used for unit and component tests.
  • @testing-library/react: for rendering components and asserting on user-visible behaviour.
  • msw (Mock Service Worker) or simple mocks: to stub API requests in component tests.

Test location and organisation

  • Primary test folder: app/frontend/src/tests.
  • File naming: ComponentName.test.tsx.

Running tests

  • Unit/component tests: npm/yarn script configured in package.json (runs Vitest).
  • Run locally in watch mode for TDD and in CI for single-run verification.