Skip to content

Commit a8d7fc4

Browse files
committed
test: add test for name hint in findBy query
1 parent cfcb392 commit a8d7fc4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/__tests__/role.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,14 @@ test('has no useful error message in findBy', async () => {
363363
)
364364
})
365365

366+
test('findBy contains a name hint', async () => {
367+
const {findByRole} = render(`<button>Click me</button>`)
368+
369+
await expect(findByRole('button', {name: 'Submit'})).rejects.toThrow(
370+
'Unable to find role="button" and name "Submit"',
371+
)
372+
})
373+
366374
test('explicit role is most specific', () => {
367375
const {getByRole} = renderIntoDocument(
368376
`<button role="tab" aria-label="my-tab" />`,

0 commit comments

Comments
 (0)