Skip to content

Commit 70c89bf

Browse files
authored
docs(start/framework/testing): fix code (#12516)
1 parent 487961f commit 70c89bf

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
- aymanemadidi
3939
- ayushmanchhabra
4040
- babafemij-k
41+
- barclayd
4142
- bavardage
4243
- bbrowning918
4344
- BDomzalski

docs/start/framework/testing.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ We can test this component with `createRoutesStub`. It takes an array of objects
3636

3737
```tsx
3838
import { createRoutesStub } from "react-router";
39-
import * as Test from "@testing-library/react";
39+
import { render, screen, waitFor } from "@testing-library/react";
40+
import userEvent from '@testing-library/user-event';
4041
import { LoginForm } from "./LoginForm";
4142

4243
test("LoginForm renders error messages", async () => {
@@ -59,12 +60,12 @@ test("LoginForm renders error messages", async () => {
5960
]);
6061

6162
// render the app stub at "/login"
62-
Test.render(<Stub initialEntries={["/login"]} />);
63+
render(<Stub initialEntries={["/login"]} />);
6364

6465
// simulate interactions
65-
Test.user.click(screen.getByText("Login"));
66-
await Test.waitFor(() => screen.findByText(USER_MESSAGE));
67-
await Test.waitFor(() =>
66+
userEvent.click(screen.getByText("Login"));
67+
await waitFor(() => screen.findByText(USER_MESSAGE));
68+
await waitFor(() =>
6869
screen.findByText(PASSWORD_MESSAGE)
6970
);
7071
});

0 commit comments

Comments
 (0)