Skip to content

Commit 7f1008e

Browse files
committed
chore(types): add test for queries
1 parent a8bbe3f commit 7f1008e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

types/test.tsx

+16
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,22 @@ export async function testWaitFor() {
8484
await waitFor(() => {})
8585
}
8686

87+
export function testQueries() {
88+
const {getByLabelText} = render(
89+
<label htmlFor="usernameInput">Username</label>,
90+
)
91+
expectType<HTMLElement, ReturnType<typeof getByText>>(
92+
getByLabelText('Username'),
93+
)
94+
95+
const container = document.createElement('div')
96+
const options = {container}
97+
const {getByText} = render(<div>Hello World</div>, options)
98+
expectType<HTMLElement, ReturnType<typeof getByText>>(
99+
getByText('Hello World'),
100+
)
101+
}
102+
87103
/*
88104
eslint
89105
testing-library/prefer-explicit-assert: "off",

0 commit comments

Comments
 (0)