Senior Backend Engineer / Stage 5 · Testing and delivery
Test handlers, storage and client contracts
Write unit, real-database and consumer tests.
"Already know" meets prerequisites. "Not relevant" removes the topic from your total but leaves what builds on it waiting.
Self-check
- A mocked repository accepts duplicate order IDs, but production PostgreSQL rejects them. Describe a focused handler test, a real-database transaction test and an old-client response-contract test. Which defect can each detect, and which can it miss?
- Evidence to include: Demonstrate at least one failing assertion before correcting the defect. Use an isolated database/schema and deterministic cleanup. A schema assertion alone does not prove that a real consumer can interpret the response.
Try it without the material first, then compare. Save your answer in your notes below. Report a problem with this self-check
Learning activities
3 activities- Not doneTesting (opens another site)
The official guide to testing modules, overriding providers and sending requests to a Fastify app with inject, the same style this platform's API tests use.
25 min - Not donePostgreSQL - Testcontainers for NodeJS (opens another site)
Starts a real, throwaway PostgreSQL from a test and hands back its connection URI, so storage tests run against the database you ship.
5 min - Not doneHow Pact works (opens another site)
Explains consumer tests against a mock provider and provider verification that replays them, the clearest picture of what a contract test proves.
10 min