Files
Compass/docs/development.md
MartinBraquet d27cc94dd0 Update readme
2025-09-09 14:48:47 +02:00

1.1 KiB
Raw Blame History

Documentation for development

Adding a new profile variable

To add a profile variable (personality type, etc.), make modifications here:

  • ...

Then update the database by running a migration:

...

Cover with tests

Best Practices

  • Test Behavior, Not Implementation. Dont test internal state or function calls unless youre testing utilities or very critical behavior.
  • Use msw to Mock APIs. Don't manually mock fetch—use msw to simulate realistic behavior, including network delays and errors.
  • Dont Overuse Snapshots. Snapshots are fragile and often meaningless unless used sparingly (e.g., for JSON response schemas).
  • Prefer userEvent Over fireEvent. It simulates real user interactions more accurately.
  • Avoid Testing Next.js Internals . You dont need to test getStaticProps, getServerSideProps themselves—test what they render.
  • Use jest.spyOn() for Internal Utilities . Avoid reaching into modules you dont own.
  • Don't test just for coverage. Test to prevent regressions, document intent, and handle edge cases.
  • Don't write end-to-end tests for features that change frequently unless absolutely necessary.