Skip to content

Commit 963e70e

Browse files
committed
docs(no-unnecessary-act): simplify examples
1 parent 82e7ad0 commit 963e70e

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

docs/rules/no-unnecessary-act.md

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
waitFor,
2828
fireEvent,
2929
} from '@testing-library/react';
30+
// ^ act imported from 'react-dom/test-utils' will be reported too
3031
import userEvent from '@testing-library/user-event';
3132

3233
// ...
@@ -51,6 +52,7 @@ act(() => {
5152
```js
5253
// ❌ wrapping empty callbacks in `act` is incorrect
5354
import { act } from '@testing-library/react';
55+
// ^ act imported from 'react-dom/test-utils' will be reported too
5456
import userEvent from '@testing-library/user-event';
5557

5658
// ...
@@ -60,31 +62,6 @@ act(() => {});
6062
await act(async () => {});
6163
```
6264

63-
```js
64-
// ❌ wrapping things related to Testing Library in React DOM Test Utils `act` is also incorrect
65-
import { act } from 'react-dom/test-utils';
66-
import { render, screen, waitFor, fireEvent } from '@testing-library/react';
67-
import userEvent from '@testing-library/user-event';
68-
69-
// ...
70-
71-
act(() => {
72-
render(<Example />);
73-
});
74-
75-
await act(async () => waitFor(() => {}));
76-
77-
act(() => screen.getByRole('button'));
78-
79-
act(() => {
80-
fireEvent.click(element);
81-
});
82-
83-
act(() => {
84-
userEvent.click(element);
85-
});
86-
```
87-
8865
Examples of **correct** code for this rule:
8966

9067
```js

0 commit comments

Comments
 (0)