Skip to content

Commit d08d115

Browse files
committed
test: add a test to ensure new meta gets accepted by fetchQuery
1 parent 9a0ca9b commit d08d115

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Diff for: packages/query-core/src/__tests__/queryClient.test.tsx

+22
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,28 @@ describe('queryClient', () => {
714714
expect(third).toBe(1)
715715
expect(fourth).toBe(2)
716716
})
717+
718+
test('should allow new meta', async () => {
719+
const key = queryKey()
720+
721+
const first = await queryClient.fetchQuery({
722+
queryKey: key,
723+
queryFn: ({ meta }) => Promise.resolve(meta),
724+
meta: {
725+
foo: true,
726+
},
727+
})
728+
expect(first).toStrictEqual({ foo: true })
729+
730+
const second = await queryClient.fetchQuery({
731+
queryKey: key,
732+
queryFn: ({ meta }) => Promise.resolve(meta),
733+
meta: {
734+
foo: false,
735+
},
736+
})
737+
expect(second).toStrictEqual({ foo: false })
738+
})
717739
})
718740

719741
describe('fetchInfiniteQuery', () => {

0 commit comments

Comments
 (0)