Skip to content

Commit 530a839

Browse files
committed
flow
1 parent cdac9e1 commit 530a839

File tree

1 file changed

+6
-6
lines changed
  • exercises/03.best-practices/05.problem.page-navigation

1 file changed

+6
-6
lines changed

exercises/03.best-practices/05.problem.page-navigation/README.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Page navigation
22

3-
Components in your application don't exist in a vacuum. They are likely a part of a larger component tree that describes a page that lives at a certain _route_. Whether you are building a Single Page Application, or a Multi-Page Application, or even a Statically Generated Site, you are unlikely to escape routing.
3+
Components in your application don't exist in a vacuum. They are likely a part of a larger component tree that make up a page that lives at a certain _route_. Whether you are building a Single Page Application, or a Multi-Page Application, or even a Statically Generated Site, you are unlikely to avoid routing.
44

5-
What interests us from the testing perspective here is that components can _access router data_ and _navigate to other routes_. We have to account for both of those for reliable and resilient tests.
5+
What interests us from the testing perspective here is that components can _access router data_ and _navigate to other routes_. We have to account for both of these use cases for reliable and resilient tests.
66

7-
While you were gone, I've added some routing to our application with React Router. The `<DiscountCodeForm />` now belongs to a certain route and contains a link to the cart page.
7+
While you were gone, I've added some routing to our application with React Router. The `<DiscountCodeForm />` now belongs to a certain route and contains a link to a cart page.
88

99
If you try running the tests now via `npm test`, you will be faced with the following error:
1010

@@ -13,11 +13,11 @@ Cannot destructure property 'basename' of 'React10.useContext(...)' as it is nul
1313
❯ LinkWithRef /node_modules/.vite/deps/react-router.js:8171:11
1414
```
1515

16-
This is a bit cryptic, but the stack trace here strongly suggests that the `<Link />` component is trying to read some context that is not available. In actuality, links cannot be rendered outside of the `<Router />` component, and we don't have that in our tests.
16+
This is a bit cryptic, but the stack trace here strongly suggests that the `<Link />` component is trying to read some context that is not available. In actuality, links cannot be rendered outside of the `<Router />` component, which we don't have in our tests.
1717

18-
We've covered it in the previous exercises that component-level testing doesn't involve rendering the entire component tree so the `<Router>` part introduced in `<App />` is missing.
18+
We've said previously that component-level testing doesn't involve rendering the entire component tree, so the `<Router>` rendered within `<App />` is missing.
1919

20-
👨‍💼 In this exercise, you will solve this problem and restore order to the automated tests by creating a _custom wrapper_ for rendering our `<DiscountCodeForm />` component in tests. Follow the instructions in <InlineFile file="./src/discount-code-form.browser.test.tsx">`discount-code-form.browser.test.tsx`</InlineFile> to adjust the test setup and see the tests passing again.
20+
👨‍💼 In this exercise, you will solve this problem and restore order to the automated tests by creating a _custom wrapper_ for rendering our `<DiscountCodeForm />` component in tests. Follow the instructions in <InlineFile file="./src/discount-code-form.browser.test.tsx">`discount-code-form.browser.test.tsx`</InlineFile> to adjust the test setup and get the tests passing again.
2121

2222
👨‍💼 Once that's done, complete the newly added test case for the "Back to cart" link.
2323

0 commit comments

Comments
 (0)