Skip to content

Commit

Permalink
test: instanceof Error check
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo committed Aug 2, 2024
1 parent 0090a5a commit e410e31
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/query-core/src/__tests__/query.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ describe('query', () => {
const visibilityMock = mockVisibilityState('hidden')

let count = 0
let result
let result: unknown

const promise = queryClient.fetchQuery({
queryKey: key,
Expand Down Expand Up @@ -183,8 +183,10 @@ describe('query', () => {
// Check if the error is set to the cancelled error
try {
await promise
expect.unreachable()
} catch {
expect(isCancelledError(result)).toBe(true)
expect(result instanceof Error).toBe(true)
} finally {
// Reset visibilityState to original value
visibilityMock.mockRestore()
Expand Down

0 comments on commit e410e31

Please sign in to comment.