How do you write tests for code interfacing with the network?
By sidestepping it with a Stub, to simulate different behaviors and avoid flaky tests.
A common problem faced when trying to test networking code is that the network is unpredictable and slow, resulting in non-deterministic tests — they may pass one time and fail the next.
In this chapter, we’ll see how to use the Dependency Inversion Principle and Stub Test Double techniques to decouple our code from the network’s real-world constraints.
The remote menu loading feature is almost complete. We built a view capable of updating ...