You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/__tests__/helpers.ts
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,12 +16,14 @@ test('returns global document if exists', () => {
16
16
describe('window retrieval throws when given something other than a node',()=>{
17
17
test('Promise as node',()=>{
18
18
expect(()=>
19
+
// @ts-expect-error using a promise will trhow a specific error
19
20
getWindowFromNode(newPromise(jest.fn())),
20
21
).toThrowErrorMatchingInlineSnapshot(
21
22
`"It looks like you passed a Promise object instead of a DOM node. Did you do something like \`fireEvent.click(screen.findBy...\` when you meant to use a \`getBy\` query \`fireEvent.click(screen.getBy...\`, or await the findBy query \`fireEvent.click(await screen.findBy...\`?"`,
22
23
)
23
24
})
24
25
test('unknown as node',()=>{
26
+
// @ts-expect-error using an object will throw a specific error
`"Unable to find the \\"window\\" object for the given node. Please file an issue with the code that's causing you to see this error: https://github.com/testing-library/dom-testing-library/issues/new"`,
0 commit comments