@@ -250,6 +250,20 @@ ruleTester.run(RULE_NAME, rule, {
250250 test('handled promise from function wrapping ${ asyncUtil } util is valid', async () => {
251251 await waitForSomethingAsync()
252252 });
253+ ` ,
254+ } ) ) ,
255+ ...ASYNC_UTILS . map ( ( asyncUtil ) => ( {
256+ code : `
257+ import { ${ asyncUtil } } from '${ testingFramework } ';
258+
259+ function waitForSomethingAsync() {
260+ return ${ asyncUtil } (() => somethingAsync())
261+ }
262+
263+ test('handled promise in variable declaration from function wrapping ${ asyncUtil } util is valid', async () => {
264+ const result = await waitForSomethingAsync()
265+ expect(result).toBe('foo')
266+ });
253267 ` ,
254268 } ) ) ,
255269 {
@@ -506,6 +520,32 @@ ruleTester.run(RULE_NAME, rule, {
506520 ( asyncUtil ) =>
507521 ( {
508522 code : `
523+ import { ${ asyncUtil } , render } from '${ testingFramework } ';
524+
525+ function waitForSomethingAsync() {
526+ return ${ asyncUtil } (() => somethingAsync())
527+ }
528+
529+ test('unhandled promise in variable declaration from function wrapping ${ asyncUtil } util is invalid', async () => {
530+ render()
531+ const result = waitForSomethingAsync()
532+ expect(result).toBe('foo')
533+ });
534+ ` ,
535+ errors : [
536+ {
537+ messageId : 'asyncUtilWrapper' ,
538+ line : 10 ,
539+ column : 24 ,
540+ data : { name : 'waitForSomethingAsync' } ,
541+ } ,
542+ ] ,
543+ } ) as const
544+ ) ,
545+ ...ASYNC_UTILS . map (
546+ ( asyncUtil ) =>
547+ ( {
548+ code : `
509549 import { ${ asyncUtil } } from 'some-other-library'; // rather than ${ testingFramework }
510550 test(
511551 'aggressive reporting - util "${ asyncUtil } " which is not related to testing library is invalid',
0 commit comments