Testing · Junior · Question 36 of 78
Why mock network requests in unit and integration tests?
- ✓Correct answer: To make tests fast, deterministic and independent of a real server
- 2Because
fetchdoesn't exist in Node.js - 3To hide bugs in the API
Explanation
A real backend can be slow, down or return different data. The real integration with the API is checked separately - by E2E or contract tests.