April 2020
Intermediate to advanced
716 pages
18h 55m
English
To add the client-side test in the MERN Social application, we will create a folder, called tests, in the client folder, which will contain test files relevant to testing the React components. When the test command is run, Jest will look for the test code in these files.
The test case for this example will be a test on the Post component in the frontend of the MERN Social application, and we will add tests for the Post component in a file called post.test.js. This file will be placed in the tests folder. Now that we have a file ready for adding the test code, in the next section, we will demonstrate how to add an example test case.