Testing Strategies
Prerequisites: Testing
Beyond individual Jest tests, real projects organize tests into layers:
- Unit tests — test one function/component in isolation, fast, the bulk of a test suite.
- Integration tests — test several pieces together (e.g. an API route plus a real test database).
- End-to-end tests (Playwright, Cypress) — test the whole application through a real browser, the way a user would, fewest in number since they're the slowest to run.
A healthy test suite has many unit tests, some integration tests, and few end-to-end tests — not an even split, and not only one kind.