We’ve seen how using interfaces in place of concrete classes can make our code more flexible. In the unit tests we’ve written in previous parts of this series, this layer of abstraction allowed us to replace our modules’ dependencies with testing mocks. These mocks were created and set up with specific behaviours that allowed us to isolate and precisely target parts of a system to test.
How to Unit Test and Mock Services with Date…
We’ve seen how using interfaces in place of concrete classes can make our code more flexible. In the unit tests we’ve written in previous parts of this series, this layer of abstraction allowed us to replace our modules’ dependencies with testing mocks. These mocks were created and set up with specific behaviours that allowed us to isolate and precisely target parts of a system to test.