Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC] chore(tools): disable testing-library/await-async-events ESLint rule #53757

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"caughtErrorsIgnorePattern": "^_"
}
],
"filenames-simple/naming-convention": ["warn"]
"filenames-simple/naming-convention": ["warn"],
"testing-library/await-async-events": "off"
},
"overrides": [
{
Expand Down
12 changes: 12 additions & 0 deletions tools/ui-components/src/button/button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,16 @@
// Ensure that a link element is not rendered
expect(link).not.toBeInTheDocument();
});

it('test - should trigger the onClick prop on click', () => {
const onClick = jest.fn();

render(<Button onClick={onClick}>Hello world</Button>);

const button = screen.getByRole('button', { name: /hello world/i });

userEvent.click(button);

Check warning on line 110 in tools/ui-components/src/button/button.test.tsx

View check run for this annotation

codefactor.io / CodeFactor

tools/ui-components/src/button/button.test.tsx#L110

Promise returned from async event method `click` must be handled (testing-library/await-async-events)

expect(onClick).toHaveBeenCalledTimes(1);
});
});
Loading