@@ -5,7 +5,7 @@ import { FlatCompatRuleTester as RuleTester, espreeParser } from './test-utils';
55const ruleTester = new RuleTester ( {
66 parser : espreeParser ,
77 parserOptions : {
8- ecmaVersion : 6 ,
8+ ecmaVersion : 2017 ,
99 } ,
1010} ) ;
1111
@@ -30,6 +30,13 @@ ruleTester.run('prefer-mock-shorthand', rule, {
3030 'jest.fn(() => ({}))' ,
3131 'aVariable.mockImplementation' ,
3232 'aVariable.mockImplementation()' ,
33+ 'jest.fn().mockImplementation(async () => 1);' ,
34+ 'jest.fn().mockImplementation(async function () {});' ,
35+ dedent `
36+ jest.fn().mockImplementation(async function () {
37+ return 42;
38+ });
39+ ` ,
3340 dedent `
3441 aVariable.mockImplementation(() => {
3542 if (true) {
@@ -350,12 +357,14 @@ ruleTester.run('prefer-mock-shorthand', rule, {
350357 code : dedent `
351358 aVariable
352359 .mockImplementation(() => 42)
360+ .mockImplementation(async () => 42)
353361 .mockImplementation(() => Promise.resolve(42))
354362 .mockReturnValue("hello world")
355363 ` ,
356364 output : dedent `
357365 aVariable
358366 .mockReturnValue(42)
367+ .mockImplementation(async () => 42)
359368 .mockReturnValue(Promise.resolve(42))
360369 .mockReturnValue("hello world")
361370 ` ,
@@ -370,7 +379,7 @@ ruleTester.run('prefer-mock-shorthand', rule, {
370379 messageId : 'useMockShorthand' ,
371380 data : { replacement : 'mockReturnValue' } ,
372381 column : 4 ,
373- line : 3 ,
382+ line : 4 ,
374383 } ,
375384 ] ,
376385 } ,
0 commit comments