Summary

In this chapter, you learned about the benefits of testing, and the frameworks you can use to cover your React components with tests. Jest is a fully-featured tool while Mocha lets you customize your experience.

The TestUtils let you render your components outside a browser and Enzyme is a powerful tool to access the output of rendering within the tests. We have seen how to test components using mocks and writing expectations.

We learned how Snapshot Testing can make it even easier to test the output of components and its code coverage tools helps you monitor the testing state of the codebase.

It is important to bear in mind common solutions when it comes to testing complex components such as Higher-Order Cmponents or forms with multiples ...

Get React Design Patterns and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.