diff --git a/tests/lib/rules/no-await-sync-events.test.ts b/tests/lib/rules/no-await-sync-events.test.ts index 5e69351c..67f1de3f 100644 --- a/tests/lib/rules/no-await-sync-events.test.ts +++ b/tests/lib/rules/no-await-sync-events.test.ts @@ -88,6 +88,13 @@ const FIRE_EVENT_FUNCTIONS = [ 'gotPointerCapture', 'lostPointerCapture', ]; +const SUPPORTED_TESTING_FRAMEWORKS = [ + '@testing-library/dom', + '@testing-library/angular', + '@testing-library/react', + '@testing-library/vue', + '@marko/testing-library', +]; const USER_EVENT_SYNC_FUNCTIONS = [ 'clear', 'click', @@ -168,15 +175,17 @@ ruleTester.run(RULE_NAME, rule, { }, // valid tests for fire-event when only user-event set in eventModules - ...FIRE_EVENT_FUNCTIONS.map((func) => ({ - code: ` - import { fireEvent } from '@testing-library/framework'; - test('should not report fireEvent.${func} sync event awaited', async() => { - await fireEvent.${func}('foo'); - }); - `, - options: [{ eventModules: ['user-event'] }], - })), + ...SUPPORTED_TESTING_FRAMEWORKS.flatMap((testingFramework) => + FIRE_EVENT_FUNCTIONS.map((func) => ({ + code: ` + import { fireEvent } from '${testingFramework}'; + test('should not report fireEvent.${func} sync event awaited', async() => { + await fireEvent.${func}('foo'); + }); + `, + options: [{ eventModules: ['user-event'] }], + })) + ), // valid tests for user-event when only fire-event set in eventModules ...USER_EVENT_SYNC_FUNCTIONS.map((func) => ({ @@ -192,24 +201,26 @@ ruleTester.run(RULE_NAME, rule, { invalid: [ // sync fireEvent methods with await operator are not valid - ...FIRE_EVENT_FUNCTIONS.map( - (func) => - ({ - code: ` - import { fireEvent } from '@testing-library/framework'; + ...SUPPORTED_TESTING_FRAMEWORKS.flatMap((testingFramework) => + FIRE_EVENT_FUNCTIONS.map( + (func) => + ({ + code: ` + import { fireEvent } from '${testingFramework}'; test('should report fireEvent.${func} sync event awaited', async() => { await fireEvent.${func}('foo'); }); `, - errors: [ - { - line: 4, - column: 17, - messageId: 'noAwaitSyncEvents', - data: { name: `fireEvent.${func}` }, - }, - ], - } as const) + errors: [ + { + line: 4, + column: 17, + messageId: 'noAwaitSyncEvents', + data: { name: `fireEvent.${func}` }, + }, + ], + } as const) + ) ), // sync userEvent sync methods with await operator are not valid ...USER_EVENT_SYNC_FUNCTIONS.map( @@ -234,25 +245,27 @@ ruleTester.run(RULE_NAME, rule, { // sync fireEvent methods with await operator are not valid // when only fire-event set in eventModules - ...FIRE_EVENT_FUNCTIONS.map( - (func) => - ({ - code: ` - import { fireEvent } from '@testing-library/framework'; + ...SUPPORTED_TESTING_FRAMEWORKS.flatMap((testingFramework) => + FIRE_EVENT_FUNCTIONS.map( + (func) => + ({ + code: ` + import { fireEvent } from '${testingFramework}'; test('should report fireEvent.${func} sync event awaited', async() => { await fireEvent.${func}('foo'); }); `, - options: [{ eventModules: ['fire-event'] }], - errors: [ - { - line: 4, - column: 17, - messageId: 'noAwaitSyncEvents', - data: { name: `fireEvent.${func}` }, - }, - ], - } as const) + options: [{ eventModules: ['fire-event'] }], + errors: [ + { + line: 4, + column: 17, + messageId: 'noAwaitSyncEvents', + data: { name: `fireEvent.${func}` }, + }, + ], + } as const) + ) ), // sync userEvent sync methods with await operator are not valid // when only fire-event set in eventModules diff --git a/tests/lib/rules/no-promise-in-fire-event.test.ts b/tests/lib/rules/no-promise-in-fire-event.test.ts index 086a61f6..3808f60e 100644 --- a/tests/lib/rules/no-promise-in-fire-event.test.ts +++ b/tests/lib/rules/no-promise-in-fire-event.test.ts @@ -4,7 +4,6 @@ import { createRuleTester } from '../test-utils'; const ruleTester = createRuleTester(); const SUPPORTED_TESTING_FRAMEWORKS = [ - '@testing-library/foo', '@testing-library/dom', '@testing-library/angular', '@testing-library/react', diff --git a/tests/lib/rules/no-render-in-setup.test.ts b/tests/lib/rules/no-render-in-setup.test.ts index df0b518a..5c0ba486 100644 --- a/tests/lib/rules/no-render-in-setup.test.ts +++ b/tests/lib/rules/no-render-in-setup.test.ts @@ -5,7 +5,6 @@ import { createRuleTester } from '../test-utils'; const ruleTester = createRuleTester(); const SUPPORTED_TESTING_FRAMEWORKS = [ - '@testing-library/foo', '@testing-library/angular', '@testing-library/react', '@testing-library/vue', diff --git a/tests/lib/rules/prefer-find-by.test.ts b/tests/lib/rules/prefer-find-by.test.ts index 980e6cf7..97ecc4b8 100644 --- a/tests/lib/rules/prefer-find-by.test.ts +++ b/tests/lib/rules/prefer-find-by.test.ts @@ -15,7 +15,6 @@ import { createRuleTester } from '../test-utils'; const ruleTester = createRuleTester(); const SUPPORTED_TESTING_FRAMEWORKS = [ - '@testing-library/foo', '@testing-library/dom', '@testing-library/angular', '@testing-library/react',