lecture 13 of 170 completed

A mocking policy, not a mocking habit

Route interception is powerful enough to make a suite that cannot fail. Tiering decides where it is safe.

What you'll learn

  • How to tier tests by how much they mock
  • How route.fetch keeps a response realistic
  • Why mock drift is silent by construction

Mock everything and your suite is fast, stable and worthless: it tests your mocks. Mock nothing and it is slow, flaky and dependent on every third party your app touches. The senior contribution is the policy between those, and it needs to be written down rather than left to per-test instinct.

Three tiers. Every test belongs to exactly one.

Tier one: fully real. Fifteen to thirty tests covering the critical journeys. Real server, real database, no interception at all. These are your contract check. When the backend changes shape, these break, which is the entire point.

members only

Keep reading with the full course

The Foundations track and the first 5 lectures of each framework are free. This lecture is part of the paid course, which unlocks every lecture, all three frameworks, and downloads.

See the options →