Suggest an editImprove this articleRefine the answer for “When should you mock the API, and when not?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**You should mock the API** when the backend is unstable or unavailable, when you need guaranteed data behavior, or when tests need to be fast without depending on the network. **Key point:** don't mock when you're verifying the real frontend → backend connection end-to-end or hunting for a regression in the real service rather than in fake data.Shown above the full answer for quick recall.Answer (EN)Image## When to mock the API - when the backend is unstable, unavailable or not ready yet - when guaranteed, repeatable data behavior is needed - when it is important to check rare cases (500 errors, empty responses, timeouts) - when tests need to be fast and not depend on the network - when it comes to local development or CI, where predictability matters ## When NOT to mock the API - when you need to make sure the real frontend → backend connection works end-to-end - when the test checks a real user scenario, not just the UI - when it is important to test integration, not an isolated interface - when you need to catch a regression in the real service, not in fake data **Summary in one line:** We mock for stability and speed. We don't mock when we are checking reality, not an imitation.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.