Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/vue-query/src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down
10 changes: 6 additions & 4 deletions packages/vue-query/src/__tests__/vueQueryPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, any>
$root: TestApp
Expand All @@ -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
Expand Down