December 2019
Intermediate to advanced
598 pages
12h 21m
English
Jest is the de-facto testing tool in the React community and is maintained by Facebook. Jest is included in Create React App (CRA) projects, which means that it is already installed and configured in our project. We'll start to get familiar with Jest by adding some unit tests on the required function in the Form component. So, let's open our frontend project in Visual Studio Code and carry out the following steps:
import { required } from './Form';test('When required is called with empty string, an error should be returned', () => { // TODO - call required passing in an empty string // TODO - check that an error is returned ...Read now
Unlock full access