Skip to content

Commit c284983

Browse files
committed
Update dev docs
1 parent 5fed099 commit c284983

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

docs/development.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,17 @@ Then update the database:
1919

2020
```bash
2121
npx prisma migrate dev --name add-some-profile-variable
22-
```
22+
```
23+
24+
### Cover with tests
25+
26+
Best Practices
27+
28+
* Test Behavior, Not Implementation. Don’t test internal state or function calls unless you’re testing utilities or very critical behavior.
29+
* Use msw to Mock APIs. Don't manually mock fetch—use msw to simulate realistic behavior, including network delays and errors.
30+
* Don’t Overuse Snapshots. Snapshots are fragile and often meaningless unless used sparingly (e.g., for JSON response schemas).
31+
* Prefer userEvent Over fireEvent. It simulates real user interactions more accurately.
32+
* Avoid Testing Next.js Internals . You don’t need to test getStaticProps, getServerSideProps themselves—test what they render.
33+
* Use jest.spyOn() for Internal Utilities . Avoid reaching into modules you don’t own.
34+
* Don't test just for coverage. Test to prevent regressions, document intent, and handle edge cases.
35+
* Don't write end-to-end tests for features that change frequently unless absolutely necessary.

0 commit comments

Comments
 (0)