@@ -191,7 +191,7 @@ ruleTester.run(RULE_NAME, rule, {
191191 } ,
192192 ] ) ,
193193 invalid : SUPPORTED_TESTING_FRAMEWORKS . flatMap ( ( testingFramework ) => [
194- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
194+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
195195 code : `
196196 import {${ waitMethod } , screen} from '${ testingFramework } ';
197197 it('tests', async () => {
@@ -353,7 +353,7 @@ ruleTester.run(RULE_NAME, rule, {
353353 output : null ,
354354 } ,
355355 // presence matchers
356- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
356+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
357357 code : `
358358 import {${ waitMethod } } from '${ testingFramework } ';
359359 it('tests', async () => {
@@ -382,7 +382,7 @@ ruleTester.run(RULE_NAME, rule, {
382382 })
383383 ` ,
384384 } ) ) ,
385- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
385+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
386386 code : `
387387 import {${ waitMethod } } from '${ testingFramework } ';
388388 it('tests', async () => {
@@ -411,7 +411,7 @@ ruleTester.run(RULE_NAME, rule, {
411411 })
412412 ` ,
413413 } ) ) ,
414- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
414+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
415415 code : `
416416 import {${ waitMethod } } from '${ testingFramework } ';
417417 it('tests', async () => {
@@ -440,7 +440,7 @@ ruleTester.run(RULE_NAME, rule, {
440440 })
441441 ` ,
442442 } ) ) ,
443- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
443+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
444444 code : `
445445 import {${ waitMethod } } from '${ testingFramework } ';
446446 it('tests', async () => {
@@ -469,7 +469,7 @@ ruleTester.run(RULE_NAME, rule, {
469469 })
470470 ` ,
471471 } ) ) ,
472- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
472+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
473473 code : `
474474 import {${ waitMethod } } from '${ testingFramework } ';
475475 it('tests', async () => {
@@ -498,7 +498,7 @@ ruleTester.run(RULE_NAME, rule, {
498498 })
499499 ` ,
500500 } ) ) ,
501- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
501+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
502502 code : `
503503 import {${ waitMethod } } from '${ testingFramework } ';
504504 it('tests', async () => {
@@ -527,7 +527,7 @@ ruleTester.run(RULE_NAME, rule, {
527527 })
528528 ` ,
529529 } ) ) ,
530- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
530+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
531531 code : `
532532 import {${ waitMethod } } from '${ testingFramework } ';
533533 it('tests', async () => {
@@ -556,7 +556,7 @@ ruleTester.run(RULE_NAME, rule, {
556556 })
557557 ` ,
558558 } ) ) ,
559- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
559+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
560560 code : `
561561 import {${ waitMethod } } from '${ testingFramework } ';
562562 it('tests', async () => {
@@ -583,7 +583,7 @@ ruleTester.run(RULE_NAME, rule, {
583583 })
584584 ` ,
585585 } ) ) ,
586- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
586+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
587587 code : `
588588 import {${ waitMethod } } from '${ testingFramework } ';
589589 it('tests', async () => {
@@ -610,7 +610,7 @@ ruleTester.run(RULE_NAME, rule, {
610610 })
611611 ` ,
612612 } ) ) ,
613- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
613+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
614614 code : `
615615 import {${ waitMethod } } from '${ testingFramework } ';
616616 it('tests', async () => {
@@ -637,7 +637,7 @@ ruleTester.run(RULE_NAME, rule, {
637637 })
638638 ` ,
639639 } ) ) ,
640- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
640+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
641641 code : `
642642 import {${ waitMethod } } from '${ testingFramework } ';
643643 it('tests', async () => {
@@ -664,7 +664,7 @@ ruleTester.run(RULE_NAME, rule, {
664664 })
665665 ` ,
666666 } ) ) ,
667- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
667+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
668668 code : `
669669 import {${ waitMethod } } from '${ testingFramework } ';
670670 it('tests', async () => {
@@ -693,7 +693,7 @@ ruleTester.run(RULE_NAME, rule, {
693693 } ) ) ,
694694 // Issue #579, https://github.com/testing-library/eslint-plugin-testing-library/issues/579
695695 // findBy can have two sets of options: await screen.findByText('text', queryOptions, waitForOptions)
696- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
696+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
697697 code : `import {${ waitMethod } } from '${ testingFramework } ';
698698 const button = await ${ waitMethod } (() => screen.${ queryMethod } ('Count is: 0'), { timeout: 100, interval: 200 })
699699 ` ,
@@ -714,8 +714,9 @@ ruleTester.run(RULE_NAME, rule, {
714714 ) } ('Count is: 0', { timeout: 100, interval: 200 })
715715 ` ,
716716 } ) ) ,
717- ...ASYNC_QUERIES_COMBINATIONS . map ( ( queryMethod ) => ( {
718- code : `
717+ ...ASYNC_QUERIES_COMBINATIONS . map < InvalidTestCase < MessageIds , [ ] > > (
718+ ( queryMethod ) => ( {
719+ code : `
719720 import {waitFor} from '${ testingFramework } ';
720721 it('tests', async () => {
721722 await waitFor(async () => {
@@ -724,24 +725,25 @@ ruleTester.run(RULE_NAME, rule, {
724725 })
725726 })
726727 ` ,
727- errors : [
728- {
729- messageId : 'preferFindBy' ,
730- data : {
731- queryVariant : getFindByQueryVariant ( queryMethod ) ,
732- queryMethod : queryMethod . split ( 'By' ) [ 1 ] ,
733- prevQuery : queryMethod ,
734- waitForMethodName : 'waitFor' ,
728+ errors : [
729+ {
730+ messageId : 'preferFindBy' ,
731+ data : {
732+ queryVariant : getFindByQueryVariant ( queryMethod ) ,
733+ queryMethod : queryMethod . split ( 'By' ) [ 1 ] ,
734+ prevQuery : queryMethod ,
735+ waitForMethodName : 'waitFor' ,
736+ } ,
735737 } ,
736- } ,
737- ] ,
738- output : `
738+ ] ,
739+ output : `
739740 import {waitFor} from '${ testingFramework } ';
740741 it('tests', async () => {
741742 const button = await screen.${ queryMethod } ("button", { name: "Submit" })
742743 expect(button).toBeInTheDocument()
743744 })
744745 ` ,
745- } ) ) ,
746+ } )
747+ ) ,
746748 ] ) ,
747749} ) ;
0 commit comments