April 2018
Intermediate to advanced
298 pages
6h 34m
English
The last thing you want to spend time on is testing someone else's code. Yet, sometimes you're forced to do exactly that. For example, let's say that you want to test a function that makes a fetch() call to some HTTP API. Another example: your React component uses some library to help set and manipulate its state.
In both of these examples, there's code that you didn't implement that's being run when your unit tests run. You definitely don't want to reach out to an external system over HTTP. You definitely don't want to make sure that the state of your component is being set correctly based on the output of functions from another library. For the code that we don't want to test, Jest provides a ...