Disguise Driven Testing: Jest Mocks In Depth — Part 2

1 · Nicolás Bevacqua · April 22, 2019, 9:26 a.m.
Mocks are a great way of preventing AJAX calls in tests, but they can also help you isolate side effects and impurities that can create complicated tests. As you learned in Part 1, mocks are a great way to handle external data or any data that is likely to change. Mocking external data will likely be your most common use case and for a good reason. You want your tests to stick as closely to your code as possible this includes all dependencies. Still, there are times when a dependency creates a t...