Skip to content

Commit e68646b

Browse files
committed
docs: add incorrect case
1 parent 64c976f commit e68646b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/rules/prefer-find-by.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ const submitButton = await waitFor(() =>
4141
const submitButton = await waitFor(() =>
4242
expect(queryByLabel('button', { name: /submit/i })).not.toBeFalsy()
4343
);
44+
45+
// unnecessary usage of waitFor with findBy*, which already includes waiting logic
46+
await waitFor(async () => {
47+
const button = await findByRole('button', { name: 'Submit' });
48+
expect(button).toBeInTheDocument();
49+
});
4450
```
4551

4652
Examples of **correct** code for this rule:

0 commit comments

Comments
 (0)