May 2019
Intermediate to advanced
496 pages
10h 38m
English
We can test React Router using either full rendering or shallow rendering. In this book, I'll use shallow rendering, for a couple of reasons.
The first reason is that by shallow rendering we don't need to test the effects of the React Router. We don't need to assert that our browser "navigates" and that the browser location changes. This is good because those side effects are nuanced and not straightforward to test. So, if we wanted to verify that a Link actually "works," we'd have a lot of different things to verify.
Contrast this with the tests we've written up until now, where we full-rendered buttons and happily clicked them. Why is this any different? Well, the DOM is a very well-understood ...
Read now
Unlock full access