Implementing React Tests with Jest
Learn to create automated tests for our frontend using Jest.
We'll cover the following...
We are going to turn our attention to creating automated tests for the frontend with Jest. 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 has already been installed and configured in our project.
We are going to start by testing a simple function so that we can get familiar with Jest before moving on to testing a React component.
Getting started with Jest
We'll start to get familiar with Jest by adding some unit tests to the mapQuestionFromServer
function in QuestionsData.ts
. So, let's open our frontend project in Visual ...