@@ -181,6 +181,16 @@ ruleTester.run(RULE_NAME, rule, {
181181 const buttonText = screen.getByText('submit');
182182 const userAlias = userEvent.setup();
183183 userAlias.click(buttonText);
184+ ` ,
185+ } ,
186+ {
187+ code : `
188+ import userEvent from '@testing-library/user-event';
189+ import { screen } from '${ testingFramework } ';
190+ test('...', () => {
191+ const buttonText = screen.getByText('submit');
192+ (() => { click: userEvent.click(buttonText); })();
193+ });
184194 ` ,
185195 } ,
186196 {
@@ -241,7 +251,6 @@ ruleTester.run(RULE_NAME, rule, {
241251 } ,
242252 {
243253 code : `
244- // case: custom module set but not imported using ${ testingFramework } (aggressive reporting limited)
245254 import { screen } from '${ testingFramework } ';
246255
247256 const ui = {
@@ -251,6 +260,48 @@ ruleTester.run(RULE_NAME, rule, {
251260 const select = ui.select.get();
252261 expect(select).toHaveClass(selectClasses.select);
253262 });
263+ ` ,
264+ } ,
265+ {
266+ settings : { 'testing-library/utils-module' : 'test-utils' } ,
267+ code : `
268+ // case: custom module set but not imported using ${ testingFramework } (aggressive reporting limited)
269+ import { screen, render } from 'test-utils';
270+ import MyComponent from './MyComponent'
271+
272+ test('...', async () => {
273+ const { user } = render(<MyComponent />)
274+ await user.click(screen.getByRole("button"))
275+ });
276+ ` ,
277+ } ,
278+ {
279+ settings : { 'testing-library/utils-module' : 'test-utils' } ,
280+ code : `
281+ // case: custom module set but not imported using ${ testingFramework } (aggressive reporting limited)
282+ import { screen, render } from 'test-utils';
283+ import MyComponent from './MyComponent'
284+
285+ test('...', async () => {
286+ const result = render(<MyComponent />)
287+ await result.user.click(screen.getByRole("button"))
288+ });
289+ ` ,
290+ } ,
291+ {
292+ settings : {
293+ 'testing-library/utils-module' : 'TestUtils' ,
294+ 'testing-library/custom-renders' : [ 'renderComponent' ] ,
295+ } ,
296+ code : `
297+ // case: custom module set but not imported using ${ testingFramework } (aggressive reporting limited)
298+ import { screen, renderComponent } from './TestUtils';
299+ import MyComponent from './MyComponent'
300+
301+ test('...', async () => {
302+ const result = renderComponent(<MyComponent />)
303+ await result.user.click(screen.getByRole("button"))
304+ });
254305 ` ,
255306 } ,
256307 ]
0 commit comments