In our Home component test, we tested everything, except the fact that if you click on the Navigate to Chat Screen button, navigation is executed with proper parameters.
In order to do so and also for convenience, we will install a really useful package that lets us shallow render our components in a slight different way. It also gives us the ability to search inside our components. This is the use case that we need. We need to find the Button component inside our home screen and call the onPress function. We also need know if it was called with proper arguments:
npm i enzyme react-dom --save-dev
At the moment of book publishing, enzyme does not work out of the box and you will probably get the following error:
react-dom is an implicit dependency in order to support [email protected]. Please add the appropriate version to your devDependencies.
In order to proceed...