Skip to content

Commit

Permalink
test: add a test to ensure new meta gets accepted by fetchQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
TkDodo committed Jan 4, 2025
1 parent 9a0ca9b commit d08d115
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/query-core/src/__tests__/queryClient.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,28 @@ describe('queryClient', () => {
expect(third).toBe(1)
expect(fourth).toBe(2)
})

test('should allow new meta', async () => {
const key = queryKey()

const first = await queryClient.fetchQuery({
queryKey: key,
queryFn: ({ meta }) => Promise.resolve(meta),
meta: {
foo: true,
},
})
expect(first).toStrictEqual({ foo: true })

const second = await queryClient.fetchQuery({
queryKey: key,
queryFn: ({ meta }) => Promise.resolve(meta),
meta: {
foo: false,
},
})
expect(second).toStrictEqual({ foo: false })
})
})

describe('fetchInfiniteQuery', () => {
Expand Down

0 comments on commit d08d115

Please sign in to comment.