December 2019
Intermediate to advanced
474 pages
10h 3m
English
Unit testing is an important part of your application since you want to know that your functions and components behave as expected, even when you make code changes. For this, you're going to use Jest, an open source testing package for JavaScript applications that was created by Facebook. With Jest, you can test assertions, for example, if the output of a function matches the value you expected.
To get started with Jest, you don't have to install anything; it's part of Create React App. If you look at the package.json file, you will see that a script is already there for running tests.
Let's see what happens if you execute the following command from your Terminal:
npm run test
This will return a message saying No ...
Read now
Unlock full access