File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -19,4 +19,17 @@ Then update the database:
1919
2020``` bash
2121npx 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.
You can’t perform that action at this time.
0 commit comments