@@ -361,6 +361,14 @@ ruleTester.run(RULE_NAME, rule, {
361
361
});
362
362
` ,
363
363
errors : [ { messageId : 'awaitAsyncQuery' , line : 6 , column : 21 } ] ,
364
+ output : `// async queries without await operator or then method are not valid
365
+ import { render } from '${ testingFramework } '
366
+
367
+ test("An example test", async () => {
368
+ doSomething()
369
+ const foo = await ${ query } ('foo')
370
+ });
371
+ ` ,
364
372
} as const )
365
373
)
366
374
) ,
@@ -382,6 +390,13 @@ ruleTester.run(RULE_NAME, rule, {
382
390
data : { name : query } ,
383
391
} ,
384
392
] ,
393
+ output : `// async screen queries without await operator or then method are not valid
394
+ import { render } from '@testing-library/react'
395
+
396
+ test("An example test", async () => {
397
+ await screen.${ query } ('foo')
398
+ });
399
+ ` ,
385
400
} as const )
386
401
) ,
387
402
...ALL_ASYNC_COMBINATIONS_TO_TEST . map (
@@ -403,6 +418,14 @@ ruleTester.run(RULE_NAME, rule, {
403
418
data : { name : query } ,
404
419
} ,
405
420
] ,
421
+ output : `
422
+ import { render } from '@testing-library/react'
423
+
424
+ test("An example test", async () => {
425
+ doSomething()
426
+ const foo = await ${ query } ('foo')
427
+ });
428
+ ` ,
406
429
} as const )
407
430
) ,
408
431
...ALL_ASYNC_COMBINATIONS_TO_TEST . map (
@@ -440,6 +463,13 @@ ruleTester.run(RULE_NAME, rule, {
440
463
})
441
464
` ,
442
465
errors : [ { messageId : 'awaitAsyncQuery' , line : 5 , column : 27 } ] ,
466
+ output : `
467
+ import { render } from "another-library"
468
+
469
+ test('An example test', async () => {
470
+ const example = await ${ query } ("my example")
471
+ })
472
+ ` ,
443
473
} as const )
444
474
) ,
445
475
@@ -517,6 +547,11 @@ ruleTester.run(RULE_NAME, rule, {
517
547
})
518
548
` ,
519
549
errors : [ { messageId : 'awaitAsyncQuery' , line : 3 , column : 25 } ] ,
550
+ output : `
551
+ test('An invalid example test', () => {
552
+ const element = await findByIcon('search')
553
+ })
554
+ ` ,
520
555
} ,
521
556
522
557
{
0 commit comments