-
Book Overview & Buying
-
Table Of Contents
React Application Architecture for Production - Second Edition
By :
Unit tests should be fast and focused. They should verify that individual pieces work correctly in isolation. But they can't tell us if we wired everything correctly and our application works when all these pieces come together. That's where integration tests come in.
Our unit tests might pass, but our application can still break. Integration testing catches these gaps by testing multiple parts of the application working together. Instead of testing a part of the application in isolation, we test how it works in the context of the application and all its parts. The only thing we mock is the API layer.
This is the most valuable type of testing for most applications. A good approach for integration testing is to test individual pages. This ensures we are testing the complete flow of a route, including loaders, error boundaries, and user interactions within that page.
The following diagram illustrates how integration tests cover more of the application stack...