In this React guided lab, you'll be adding Jest tests to a basic application created with Create React App and TypeScript.
Create React App uses Jest as its test runner. When you run npm test
in your terminal, Jest will launch in watch mode. Give it a try and type npm test
in your terminal. Every time you save a file, it will re-run the tests.
The guided steps will give you hands-on experience querying the DOM for nodes in a way that is similar to how the user finds elements on the page with React Testing Library.
Once you complete the tasks, they can be checked by clicking the validate button. Upon validating the code you'll be able to see your test output and a custom message in the case your code doesn't match what's expected as an acceptable solution for the task.
If you are stuck or would like to compare solutions, a solution directory has been provided for you as well.
To make the process easier, all the necessary dependencies and application code have already been added to the project. So, you are only going to focus on writing tests as instructed by each task.