So we learned that testing might make sense,
how do we test then?
We need two tools to write good tests and be able to test our react application.
The first tool is the test runner,
this is basically a tool which is responsible for executing our tests
so for running the code, test code and providing a validation library which in the end is a library which allows
us to do comparations and potentially throw some errors.
The idea behind unit tests is that they don't run in the browser but instead with nodeJS though often
emulated to be in a browser environment with the help of specific javascript packages. The test runner
then is the core tool which simply executes our code using that environment
and the good thing is create react app already comes with a pre-configured testing environment
we can build up on.
So that's the test runner and we will use jest in this course, jest is already installed in the app
created with create react app and is a popular javascript testing tool which is not limited to react
but often used in react apps. Now running the test is one thing, when working with reacting components,
we also need a way of emulating these components, so basically mounting them to some non-existent dom you
could say and then traversing our components and we want to do this in an efficient quick way without
having to actually create that whole component tree which might also introduce some side effects.
For this, we need testing utilities which help us with testing and there, we specifically need the just
described help to simulate the react app, mount components and dig into that dom which is created with react.
In this course we could you as react test utils, that's the official utility tool but there's another tool
which became more and more important and interesting and is also suggested by the react team
amd that's enzyme. Enzyme is a tool developed by AirBnB,
they use react in a lot of their projects and they share this tool which makes it easy to mount components
and then navigate through them
and I will of course show you how to use both tools, jest and enzyme in this course.
So these are the testing tools, that leaves us only with one question, what should we test?