@@ -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 {
@@ -278,7 +288,6 @@ ruleTester.run(RULE_NAME, rule, {
278288 } ,
279289 {
280290 code : `
281- // case: custom module set but not imported using ${ testingFramework } (aggressive reporting limited)
282291 import { screen } from '${ testingFramework } ';
283292
284293 const ui = {
@@ -288,6 +297,48 @@ ruleTester.run(RULE_NAME, rule, {
288297 const select = ui.select.get();
289298 expect(select).toHaveClass(selectClasses.select);
290299 });
300+ ` ,
301+ } ,
302+ {
303+ settings : { 'testing-library/utils-module' : 'test-utils' } ,
304+ code : `
305+ // case: custom module set but not imported using ${ testingFramework } (aggressive reporting limited)
306+ import { screen, render } from 'test-utils';
307+ import MyComponent from './MyComponent'
308+
309+ test('...', async () => {
310+ const { user } = render(<MyComponent />)
311+ await user.click(screen.getByRole("button"))
312+ });
313+ ` ,
314+ } ,
315+ {
316+ settings : { 'testing-library/utils-module' : 'test-utils' } ,
317+ code : `
318+ // case: custom module set but not imported using ${ testingFramework } (aggressive reporting limited)
319+ import { screen, render } from 'test-utils';
320+ import MyComponent from './MyComponent'
321+
322+ test('...', async () => {
323+ const result = render(<MyComponent />)
324+ await result.user.click(screen.getByRole("button"))
325+ });
326+ ` ,
327+ } ,
328+ {
329+ settings : {
330+ 'testing-library/utils-module' : 'TestUtils' ,
331+ 'testing-library/custom-renders' : [ 'renderComponent' ] ,
332+ } ,
333+ code : `
334+ // case: custom module set but not imported using ${ testingFramework } (aggressive reporting limited)
335+ import { screen, renderComponent } from './TestUtils';
336+ import MyComponent from './MyComponent'
337+
338+ test('...', async () => {
339+ const result = renderComponent(<MyComponent />)
340+ await result.user.click(screen.getByRole("button"))
341+ });
291342 ` ,
292343 } ,
293344 ]
0 commit comments