Skip to content

Commit

Permalink
chore(types): add test for queries
Browse files Browse the repository at this point in the history
  • Loading branch information
solufa committed Feb 2, 2021
1 parent a8bbe3f commit 7f1008e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions types/test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ export async function testWaitFor() {
await waitFor(() => {})
}

export function testQueries() {
const {getByLabelText} = render(
<label htmlFor="usernameInput">Username</label>,
)
expectType<HTMLElement, ReturnType<typeof getByText>>(
getByLabelText('Username'),
)

const container = document.createElement('div')
const options = {container}
const {getByText} = render(<div>Hello World</div>, options)
expectType<HTMLElement, ReturnType<typeof getByText>>(
getByText('Hello World'),
)
}

/*
eslint
testing-library/prefer-explicit-assert: "off",
Expand Down

0 comments on commit 7f1008e

Please sign in to comment.