Pick the fix
A bug in a JOIN reached production even though unit tests passed. The repository was mocked. Best fix?
Hint 1 of 1
Did the SQL ever run in a test?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Add integration tests that run repository queries against a real Postgres
Correct. Mocks never execute the SQL.
A mock returns what the test told it to, so the SQL never runs. Only a test against a real database checks the JOIN, its types and its NULL handling.
Why not the others?
- B Add more mocked unit tests. They still don't run the query.
- C Raise coverage to 100%. Coverage of mocked code doesn't test SQL.
- D Only test manually. Slow and unrepeatable.