We'll start our unit testing journey in this section by implementing a unit test on a pure function.
A pure function has a consistent output value for a given set of parameter values. Pure functions only depend on the function arguments, and on nothing outside the function. These functions also don't change any of the argument values passed into them.
The fact that these functions only depend on their parameter values makes them straightforward to unit test.
We are going to implement a unit test on the required validator function we created in our Form component in the React shop we built. If you haven't already, open this project in Visual Studio Code.
We are going to use Jest, which is very popular for unit testing React apps, as our unit testing framework. Luckily the create-react-app tool installs and configures this for us when creating...