Transcript
00:00 Components you create don't exist in a vacuum. They're part of a larger component tree that eventually comprises a page. And whether you're building single-page or multi-page applications, there will still be a way to navigate from one page to another, which means you also need to know how to test the components that initiate that navigation, like our discount code form.
00:19 I went in and refactored this application to have client-side routing using React Router. Our form now has a link that allows the user to return to the cart page by clicking on it. But you see, in order for this link to render, it needs a routing context. It gets that context because somewhere up the component tree, it has this browser provider,
00:38 this browser router component. But here we have a problem similar to the shared assets we had before. In our isolated component test for this form, there is no such component, no such provider. So the routing context will be missing and rendering that link will fail. This is where you come in. In this exercise, you will create a custom wrapper function
00:57 that will provide this missing context and make sure that the existing tests are passing. But then write a new test case for the back to the cart link. And while you're doing that, make sure to ask yourself a question. How much of this navigation is the responsibility of this form? And how much is not? I know you're gonna nail this one, so see you once you're done.