NestJS · Middle · Question 43 of 75
Why is it useful to test against a real database in Docker for repository code?
- ✓Correct answer: Mocks don't catch wrong queries, constraint violations or migration problems
- 2Nest requires Docker for tests
- 3Docker makes tests faster than mocks
Explanation
Use transactions rolled back after each test or a fresh schema per test run to keep tests isolated.