Although there are many libraries available for unit testing in React, we are going to focus on the top two widely talked about libraries in React for unit testing - Enzyme by Airbnb and React Testing Library from Kent C Odds.
We are going to test the same component using the above two libraries. We are going to look into testing the below code
- Async functions
- Timer functions
- Mocking functions
The idea of this tutorial is to explain the comparison between the testing using the above libraries. This tutorial will also help you understand how the unit testing and its concept work in different libraries, and you will be able to appreciate the pros and cons of them.