diff --git a/packages/vue-query/src/__tests__/utils.test.ts b/packages/vue-query/src/__tests__/utils.test.ts index e287fcd266..8dead5d899 100644 --- a/packages/vue-query/src/__tests__/utils.test.ts +++ b/packages/vue-query/src/__tests__/utils.test.ts @@ -142,6 +142,12 @@ describe('utils', () => { }) }) + test('should clone getters returning values in queryKey', () => { + const val = ref({ queryKey: [1, 2, () => '3'] }) + const cp = cloneDeepUnref(val) + expect(cp).toStrictEqual({ queryKey: [1, 2, '3'] }) + }) + test('should unref undefined', () => { expect(cloneDeepUnref(ref(undefined))).toBe(undefined) }) diff --git a/packages/vue-query/src/__tests__/vueQueryPlugin.test.ts b/packages/vue-query/src/__tests__/vueQueryPlugin.test.ts index 3896947fe5..b45228a303 100644 --- a/packages/vue-query/src/__tests__/vueQueryPlugin.test.ts +++ b/packages/vue-query/src/__tests__/vueQueryPlugin.test.ts @@ -14,9 +14,11 @@ vi.mock('../devtools/devtools') vi.mock('../useQueryClient') vi.mock('../useBaseQuery') +type UnmountCallback = () => void + interface TestApp extends App { - onUnmount: Function - _unmount: Function + onUnmount: UnmountCallback + _unmount: UnmountCallback _mixin: ComponentOptions _provided: Record $root: TestApp @@ -29,11 +31,11 @@ function getAppMock(withUnmountHook = false): TestApp { provide: vi.fn(), unmount: vi.fn(), onUnmount: withUnmountHook - ? vi.fn((u: Function) => { + ? vi.fn((u: UnmountCallback) => { mock._unmount = u }) : undefined, - mixin: (m: ComponentOptions): any => { + mixin: (m: ComponentOptions) => { mock._mixin = m }, } as unknown as TestApp