From d08d115d9217f98545d29fe316f28073e36097f3 Mon Sep 17 00:00:00 2001 From: Dominik Dorfmeister Date: Sat, 4 Jan 2025 12:25:59 +0100 Subject: [PATCH] test: add a test to ensure new meta gets accepted by fetchQuery --- .../src/__tests__/queryClient.test.tsx | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/query-core/src/__tests__/queryClient.test.tsx b/packages/query-core/src/__tests__/queryClient.test.tsx index 11f2129db9..c308dd1b9a 100644 --- a/packages/query-core/src/__tests__/queryClient.test.tsx +++ b/packages/query-core/src/__tests__/queryClient.test.tsx @@ -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', () => {