diff --git a/src/rules/__tests__/prefer-hooks-on-top.test.ts b/src/rules/__tests__/prefer-hooks-on-top.test.ts index e5cfa4209..d7ba071be 100644 --- a/src/rules/__tests__/prefer-hooks-on-top.test.ts +++ b/src/rules/__tests__/prefer-hooks-on-top.test.ts @@ -45,6 +45,48 @@ ruleTester.run('basic describe block', rule, { }, ], }, + { + code: dedent` + describe('foo', () => { + beforeEach(() => {}); + test.each\`\`('bar', () => { + someFn(); + }); + beforeAll(() => {}); + test.only('bar', () => { + someFn(); + }); + }); + `, + errors: [ + { + messageId: 'noHookOnTop', + column: 3, + line: 6, + }, + ], + }, + { + code: dedent` + describe('foo', () => { + beforeEach(() => {}); + test.only.each\`\`('bar', () => { + someFn(); + }); + beforeAll(() => {}); + test.only('bar', () => { + someFn(); + }); + }); + `, + errors: [ + { + messageId: 'noHookOnTop', + column: 3, + line: 6, + }, + ], + }, ], });