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