Skip to content

Commit 5d0ec0d

Browse files
committed
test: add test case for handling 'forEach' with userEvent clicks
1 parent 8cf41e0 commit 5d0ec0d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/lib/rules/await-async-events.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,5 +1269,24 @@ ruleTester.run(RULE_NAME, rule, {
12691269
})
12701270
`,
12711271
},
1272+
{
1273+
code: `
1274+
import userEvent from '${USER_EVENT_ASYNC_FRAMEWORKS[0]}'
1275+
test('setup method called is valid', () => {
1276+
const foo = [];
1277+
foo.forEach(() => {
1278+
userEvent.click();
1279+
});
1280+
})
1281+
`,
1282+
errors: [
1283+
{
1284+
line: 6,
1285+
column: 6,
1286+
messageId: 'awaitAsyncEvent',
1287+
data: { name: 'click' },
1288+
},
1289+
],
1290+
},
12721291
],
12731292
});

0 commit comments

Comments
 (0)