Skip to content

Commit f2616e2

Browse files
committed
test: fix some assertions that relied on undefined being in pageParams
1 parent d920c84 commit f2616e2

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

packages/react-query/src/__tests__/useInfiniteQuery.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ describe('useInfiniteQuery', () => {
464464
})
465465
expect(states[1]).toMatchObject({
466466
data: { pages: [10] },
467-
hasNextPage: false,
467+
hasNextPage: true,
468468
hasPreviousPage: true,
469469
isFetching: false,
470470
isFetchingNextPage: false,
@@ -473,7 +473,7 @@ describe('useInfiniteQuery', () => {
473473
})
474474
expect(states[2]).toMatchObject({
475475
data: { pages: [10] },
476-
hasNextPage: false,
476+
hasNextPage: true,
477477
hasPreviousPage: true,
478478
isFetching: true,
479479
isFetchingNextPage: false,
@@ -482,7 +482,7 @@ describe('useInfiniteQuery', () => {
482482
})
483483
expect(states[3]).toMatchObject({
484484
data: { pages: [9, 10] },
485-
hasNextPage: false,
485+
hasNextPage: true,
486486
hasPreviousPage: true,
487487
isFetching: false,
488488
isFetchingNextPage: false,
@@ -725,7 +725,7 @@ describe('useInfiniteQuery', () => {
725725

726726
let callIndex = 0
727727
const firstCtx = fetchPage.mock.calls[callIndex]![0]
728-
expect(firstCtx.pageParam).toBeUndefined()
728+
expect(firstCtx.pageParam).toEqual(start)
729729
expect(firstCtx.queryKey).toEqual(key)
730730
expect(firstCtx.signal).toBeInstanceOf(AbortSignal)
731731
expect(firstCtx.signal.aborted).toBe(false)
@@ -802,7 +802,7 @@ describe('useInfiniteQuery', () => {
802802

803803
let callIndex = 0
804804
const firstCtx = fetchPage.mock.calls[callIndex]![0]
805-
expect(firstCtx.pageParam).toBeUndefined()
805+
expect(firstCtx.pageParam).toEqual(start)
806806
expect(firstCtx.queryKey).toEqual(key)
807807
expect(firstCtx.signal).toBeInstanceOf(AbortSignal)
808808
expect(firstCtx.signal.aborted).toBe(false)

packages/solid-query/src/__tests__/createInfiniteQuery.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ describe('useInfiniteQuery', () => {
486486
})
487487
expect(states[1]).toMatchObject({
488488
data: { pages: [10] },
489-
hasNextPage: false,
489+
hasNextPage: true,
490490
hasPreviousPage: true,
491491
isFetching: false,
492492
isFetchingNextPage: false,
@@ -495,7 +495,7 @@ describe('useInfiniteQuery', () => {
495495
})
496496
expect(states[2]).toMatchObject({
497497
data: { pages: [10] },
498-
hasNextPage: false,
498+
hasNextPage: true,
499499
hasPreviousPage: true,
500500
isFetching: true,
501501
isFetchingNextPage: false,
@@ -504,7 +504,7 @@ describe('useInfiniteQuery', () => {
504504
})
505505
expect(states[3]).toMatchObject({
506506
data: { pages: [9, 10] },
507-
hasNextPage: false,
507+
hasNextPage: true,
508508
hasPreviousPage: true,
509509
isFetching: false,
510510
isFetchingNextPage: false,
@@ -764,7 +764,7 @@ describe('useInfiniteQuery', () => {
764764

765765
let callIndex = 0
766766
const firstCtx = fetchPage.mock.calls[callIndex]![0]
767-
expect(firstCtx.pageParam).toBeUndefined()
767+
expect(firstCtx.pageParam).toEqual(start)
768768
expect(firstCtx.queryKey).toEqual(key)
769769
expect(firstCtx.signal).toBeInstanceOf(AbortSignal)
770770
expect(firstCtx.signal.aborted).toBe(false)
@@ -846,7 +846,7 @@ describe('useInfiniteQuery', () => {
846846

847847
let callIndex = 0
848848
const firstCtx = fetchPage.mock.calls[callIndex]![0]
849-
expect(firstCtx.pageParam).toBeUndefined()
849+
expect(firstCtx.pageParam).toEqual(start)
850850
expect(firstCtx.queryKey).toEqual(key)
851851
expect(firstCtx.signal).toBeInstanceOf(AbortSignal)
852852
expect(firstCtx.signal.aborted).toBe(false)

packages/vue-query/src/__tests__/queryClient.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ describe('QueryCache', () => {
267267
})
268268

269269
expect(QueryClientOrigin.prototype.fetchInfiniteQuery).toBeCalledWith({
270+
defaultPageParam: 0,
270271
queryKey: queryKeyUnref,
271272
})
272273
})
@@ -283,6 +284,7 @@ describe('QueryCache', () => {
283284
})
284285

285286
expect(QueryClientOrigin.prototype.prefetchInfiniteQuery).toBeCalledWith({
287+
defaultPageParam: 0,
286288
queryKey: queryKeyUnref,
287289
queryFn: fn,
288290
})

0 commit comments

Comments
 (0)