Testing
Of course, we need to set up some unit testing. We will not create tests right now, but we will setup the environment so tests are possible.
For the front-end, this is all set for us by create-react-app
. You can check that, just go to the front
directory, run
And you will see the result right away.
note If you use react-native-web
, read how to set it up
Now, let's take care of the back-end. There are many testing libraries to choose from, but create-react-app
have decided on jest
. For consistency, we will use that on the back-end too. Move to the back
directory.
It would be nice if we could just install jest, unfortunately, it doesn't really work (see the issue here), so we have to install that bridge thing.
add the script to package.json
:
let's create two files, just to make sure things work (we can remove them later)
run
you can also try:
For coverage report.
You can delete those two files now, we know testing works.
Last updated