Skip to content

Commit

Permalink
test(react-query-4): type test for usePrefetchQuery, usePrefetchInfin…
Browse files Browse the repository at this point in the history
…iteQuery (#1359)

close #1298

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/toss/suspensive/blob/main/CONTRIBUTING.md)
2. I added documents and tests.
  • Loading branch information
manudeli authored Nov 14, 2024
1 parent d2fdc90 commit 912937e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/react-query-4/src/usePrefetchInfiniteQuery.test-d.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { infiniteQueryOptions } from './infiniteQueryOptions'
import { queryFn, queryKey } from './test-utils'
import { usePrefetchInfiniteQuery } from './usePrefetchInfiniteQuery'

describe('usePrefetchInfiniteQuery', () => {
it('type check', () => {
expectTypeOf(usePrefetchInfiniteQuery({ queryFn, queryKey }))
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
.toEqualTypeOf<void>()
expectTypeOf(usePrefetchInfiniteQuery(infiniteQueryOptions({ queryFn, queryKey })))
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
.toEqualTypeOf<void>()
})
})
14 changes: 14 additions & 0 deletions packages/react-query-4/src/usePrefetchQuery.test-d.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { queryOptions } from './queryOptions'
import { queryFn, queryKey } from './test-utils'
import { usePrefetchQuery } from './usePrefetchQuery'

describe('usePrefetchQuery', () => {
it('type check', () => {
expectTypeOf(usePrefetchQuery({ queryFn, queryKey }))
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
.toEqualTypeOf<void>()
expectTypeOf(usePrefetchQuery(queryOptions({ queryFn, queryKey })))
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
.toEqualTypeOf<void>()
})
})

0 comments on commit 912937e

Please sign in to comment.