Open History to see the last commit
1import { ref } from 'vue-demi'
2import { MutationCache as MutationCacheOrigin } from '@tanstack/query-core'
3β
4import { vi } from 'vitest'
5import { MutationCache } from '../mutationCache'
6β
7describe('MutationCache', () => {
8 beforeAll(() => {
9 vi.spyOn(MutationCacheOrigin.prototype, 'find')
10 vi.spyOn(MutationCacheOrigin.prototype, 'findAll')
11 })
12β
13 describe('find', () => {
14 test('should properly unwrap parameters', async () => {
15 const mutationCache = new MutationCache()
16β
17 mutationCache.find({
18 mutationKey: ref(['baz']),
19 })
20β
21 expect(MutationCacheOrigin.prototype.find).toBeCalledWith({
22 mutationKey: ['baz'],
23 })
24 })
25 })
26β
27 describe('findAll', () => {
28 test('should properly unwrap parameters', async () => {
29 const mutationCache = new MutationCache()
30β
31 mutationCache.findAll({
32 mutationKey: ref(['baz']),
33 })
34β
35 expect(MutationCacheOrigin.prototype.findAll).toBeCalledWith({
36 mutationKey: ['baz'],
37 })
38 })
39 })
40})