Skip to content

Commit eff99bd

Browse files
committed
test: add tests for the return value cases of render
1 parent 87c536e commit eff99bd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,25 @@ ruleTester.run(RULE_NAME, rule, {
491491
code: `
492492
import { render } from '@testing-library/react'
493493
494+
test("An example test", async () => {
495+
const view = render(<Component />)
496+
const foo = view.${query}('foo')
497+
});
498+
`,
499+
errors: [{ messageId: 'awaitAsyncQuery', line: 6, column: 26 }],
500+
output: `
501+
import { render } from '@testing-library/react'
502+
503+
test("An example test", async () => {
504+
const view = render(<Component />)
505+
const foo = await view.${query}('foo')
506+
});
507+
`,
508+
})),
509+
...ALL_ASYNC_COMBINATIONS_TO_TEST.map<RuleInvalidTestCase>((query) => ({
510+
code: `
511+
import { render } from '@testing-library/react'
512+
494513
test("An example test", async () => {
495514
const foo = ${query}('foo')
496515
expect(foo).toBeInTheDocument()

0 commit comments

Comments
 (0)