@@ -191,7 +191,7 @@ ruleTester.run(RULE_NAME, rule, {
191
191
} ,
192
192
] ) ,
193
193
invalid : SUPPORTED_TESTING_FRAMEWORKS . flatMap ( ( testingFramework ) => [
194
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
194
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
195
195
code : `
196
196
import {${ waitMethod } , screen} from '${ testingFramework } ';
197
197
it('tests', async () => {
@@ -353,7 +353,7 @@ ruleTester.run(RULE_NAME, rule, {
353
353
output : null ,
354
354
} ,
355
355
// presence matchers
356
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
356
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
357
357
code : `
358
358
import {${ waitMethod } } from '${ testingFramework } ';
359
359
it('tests', async () => {
@@ -382,7 +382,7 @@ ruleTester.run(RULE_NAME, rule, {
382
382
})
383
383
` ,
384
384
} ) ) ,
385
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
385
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
386
386
code : `
387
387
import {${ waitMethod } } from '${ testingFramework } ';
388
388
it('tests', async () => {
@@ -411,7 +411,7 @@ ruleTester.run(RULE_NAME, rule, {
411
411
})
412
412
` ,
413
413
} ) ) ,
414
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
414
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
415
415
code : `
416
416
import {${ waitMethod } } from '${ testingFramework } ';
417
417
it('tests', async () => {
@@ -440,7 +440,7 @@ ruleTester.run(RULE_NAME, rule, {
440
440
})
441
441
` ,
442
442
} ) ) ,
443
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
443
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
444
444
code : `
445
445
import {${ waitMethod } } from '${ testingFramework } ';
446
446
it('tests', async () => {
@@ -469,7 +469,7 @@ ruleTester.run(RULE_NAME, rule, {
469
469
})
470
470
` ,
471
471
} ) ) ,
472
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
472
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
473
473
code : `
474
474
import {${ waitMethod } } from '${ testingFramework } ';
475
475
it('tests', async () => {
@@ -498,7 +498,7 @@ ruleTester.run(RULE_NAME, rule, {
498
498
})
499
499
` ,
500
500
} ) ) ,
501
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
501
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
502
502
code : `
503
503
import {${ waitMethod } } from '${ testingFramework } ';
504
504
it('tests', async () => {
@@ -527,7 +527,7 @@ ruleTester.run(RULE_NAME, rule, {
527
527
})
528
528
` ,
529
529
} ) ) ,
530
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
530
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
531
531
code : `
532
532
import {${ waitMethod } } from '${ testingFramework } ';
533
533
it('tests', async () => {
@@ -556,7 +556,7 @@ ruleTester.run(RULE_NAME, rule, {
556
556
})
557
557
` ,
558
558
} ) ) ,
559
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
559
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
560
560
code : `
561
561
import {${ waitMethod } } from '${ testingFramework } ';
562
562
it('tests', async () => {
@@ -583,7 +583,7 @@ ruleTester.run(RULE_NAME, rule, {
583
583
})
584
584
` ,
585
585
} ) ) ,
586
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
586
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
587
587
code : `
588
588
import {${ waitMethod } } from '${ testingFramework } ';
589
589
it('tests', async () => {
@@ -610,7 +610,7 @@ ruleTester.run(RULE_NAME, rule, {
610
610
})
611
611
` ,
612
612
} ) ) ,
613
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
613
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
614
614
code : `
615
615
import {${ waitMethod } } from '${ testingFramework } ';
616
616
it('tests', async () => {
@@ -637,7 +637,7 @@ ruleTester.run(RULE_NAME, rule, {
637
637
})
638
638
` ,
639
639
} ) ) ,
640
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
640
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
641
641
code : `
642
642
import {${ waitMethod } } from '${ testingFramework } ';
643
643
it('tests', async () => {
@@ -664,7 +664,7 @@ ruleTester.run(RULE_NAME, rule, {
664
664
})
665
665
` ,
666
666
} ) ) ,
667
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
667
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
668
668
code : `
669
669
import {${ waitMethod } } from '${ testingFramework } ';
670
670
it('tests', async () => {
@@ -693,7 +693,7 @@ ruleTester.run(RULE_NAME, rule, {
693
693
} ) ) ,
694
694
// Issue #579, https://github.com/testing-library/eslint-plugin-testing-library/issues/579
695
695
// findBy can have two sets of options: await screen.findByText('text', queryOptions, waitForOptions)
696
- ...createScenario ( ( waitMethod : string , queryMethod : string ) => ( {
696
+ ...createScenario ( ( waitMethod , queryMethod ) => ( {
697
697
code : `import {${ waitMethod } } from '${ testingFramework } ';
698
698
const button = await ${ waitMethod } (() => screen.${ queryMethod } ('Count is: 0'), { timeout: 100, interval: 200 })
699
699
` ,
@@ -714,8 +714,9 @@ ruleTester.run(RULE_NAME, rule, {
714
714
) } ('Count is: 0', { timeout: 100, interval: 200 })
715
715
` ,
716
716
} ) ) ,
717
- ...ASYNC_QUERIES_COMBINATIONS . map ( ( queryMethod ) => ( {
718
- code : `
717
+ ...ASYNC_QUERIES_COMBINATIONS . map < InvalidTestCase < MessageIds , [ ] > > (
718
+ ( queryMethod ) => ( {
719
+ code : `
719
720
import {waitFor} from '${ testingFramework } ';
720
721
it('tests', async () => {
721
722
await waitFor(async () => {
@@ -724,24 +725,25 @@ ruleTester.run(RULE_NAME, rule, {
724
725
})
725
726
})
726
727
` ,
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
+ } ,
735
737
} ,
736
- } ,
737
- ] ,
738
- output : `
738
+ ] ,
739
+ output : `
739
740
import {waitFor} from '${ testingFramework } ';
740
741
it('tests', async () => {
741
742
const button = await screen.${ queryMethod } ("button", { name: "Submit" })
742
743
expect(button).toBeInTheDocument()
743
744
})
744
745
` ,
745
- } ) ) ,
746
+ } )
747
+ ) ,
746
748
] ) ,
747
749
} ) ;
0 commit comments