- Write integration tests for API endpoints, database operations, and cross-module interactions.
- Run integration tests after implementation to verify components work together correctly.
- Use a real (or realistic) test database — don't mock everything in integration tests.
- Test API routes end-to-end: send a request, verify the response status, body, and side effects (DB writes, events).
- Use test databases with migrations applied — seed minimal data in `beforeEach`, clean up in `afterEach`.
- Test service-to-service interactions: verify that module A correctly calls module B with expected inputs.
- Integration tests are slower than unit tests — run them in CI and before merging, not necessarily on every save.
- Test authentication and authorization flows as integration tests — they span multiple layers.