Skip to Main Content
React Projects
book

React Projects

by Roy Derks
December 2019
Intermediate to advanced content levelIntermediate to advanced
474 pages
10h 3m
English
Packt Publishing
Content preview from React Projects

Integration testing with Enzyme

The tests that we've created all use shallow rendering to render components, but, with Enzyme, we also have the option to mount components. When using this, we can enable lifecycles and test larger components deeper than just the first level. When we want to test multiple components at once, this is called integration testing. In our application, the components that are rendered directly by the routes are rendering other components as well. A good example of this is the Hotels component, which renders the list of hotels that were returned by the Context. Let's get started:

  1. As always, the starting point is to create a new file with the .test suffix in the same directory that the component we want to test is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

React Projects - Second Edition

React Projects - Second Edition

Roy Derks
Test-Driven React

Test-Driven React

Trevor Burnham

Publisher Resources

ISBN: 9781789954937Supplemental Content