Skip to content

Commit 15b6335

Browse files
committed
Add typetest for lifecycle data
1 parent 038c8a3 commit 15b6335

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/toolkit/src/query/tests/infiniteQueries.test-d.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ describe('Infinite queries', () => {
4141

4242
return `https://example.com/listItems?page=${pageParam}`
4343
},
44+
async onCacheEntryAdded(arg, api) {
45+
const data = await api.cacheDataLoaded
46+
expectTypeOf(data.data).toEqualTypeOf<
47+
InfiniteData<Pokemon[], number>
48+
>()
49+
},
50+
async onQueryStarted(arg, api) {
51+
const data = await api.queryFulfilled
52+
expectTypeOf(data.data).toEqualTypeOf<
53+
InfiniteData<Pokemon[], number>
54+
>()
55+
},
4456
}),
4557
}),
4658
})

0 commit comments

Comments
 (0)