Loading lesson…
Level 1 · Apprentice0 XP
Replace slow or external parts in tests, and choose the right kind of double.
Step 1 / 6
ProblemA test sets up eight mocks, each returning prepared values, and verifies that each was called in order. The real code changes its order of calls, behaviour stays correct, and the test fails anyway.
← → step
Before this: The test pyramid, trophy and honeycomb
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Rewrite a mock-heavy test into one that uses an in-memory fake for the repository and a recording spy for the external service. Then run the same adapter contract suite against the fake and the real adapter.