Testing·Intermediate·Conceptual·1 min read
When should a network request be mocked?
Short interview answer
Mock at a realistic boundary when testing deterministic UI states and rare failures, preferably with request-level tools rather than mocking internal fetch wrappers. Keep some end-to-end coverage against a real compatible backend to detect contract drift.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.