- Write tests alongside source files (`*.test.js`) or in a `__tests__/` directory.
- Use the Arrange-Act-Assert pattern: set up data, perform the action, verify the result.
- Use `describe()` blocks for grouping and `it()` / `test()` for individual cases — follow the Arrange-Act-Assert pattern in each test.
- Mock external dependencies (APIs, databases) — test your logic, not the network.
- Use `describe` blocks to group related tests. Use `it` with descriptive names: `it("should return 404 when user not found")`.
- Use `beforeEach` for setup and `afterEach` for cleanup — avoid shared mutable state between tests.