Open
Description
configure eslint-plugin-testing-library
and fix issues
See mui/toolpad#3648 as an implementation example.
Could also be helpful in:
- 1. [code-infra] In react tests, clean up our act() #174
- 2. Use
screen
at the import level, not the mounting point level:
-import { render } from '@testing-library/react';
+import { render, screen } from '@testing-library/react';
test('renders content correctly', async () => {
- const { getByText } = render(<AppProvider>Hello world</AppProvider>);
+ render(<AppProvider>Hello world</AppProvider>);
- expect(getByText('Hello world')).toBeTruthy();
+ expect(screen.getByText('Hello world')).toBeTruthy();
});
});
For example mui/material-ui#41061 (comment)
- 3. Use
user
at the import level, not the mounting point level: [core] Support@mui/material@6
peer dependency mui-x#14142 (comment). Actually maybe not: [code-infra] Optimize@testing-library/user-event
material-ui#43804 (comment).