snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
Some checks failed
autofix.ci / autofix (push) Failing after 4s
Release / Release (push) Has been skipped
GitHub Actions Security Analysis / Run zizmor (push) Failing after 2s

This commit is contained in:
upstream-mirror
2026-09-16 01:13:08 +05:00
commit 3a013ccdfe
3570 changed files with 490194 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import { beforeAll, describe, expect, it, vi } from 'vitest'
import { ref } from 'vue-demi'
import { QueryCache as QueryCacheOrigin } from '@tanstack/query-core'
import { QueryCache } from '../queryCache'
describe('QueryCache', () => {
beforeAll(() => {
vi.spyOn(QueryCacheOrigin.prototype, 'find')
vi.spyOn(QueryCacheOrigin.prototype, 'findAll')
})
describe('find', () => {
it('should properly unwrap parameters', () => {
const queryCache = new QueryCache()
queryCache.find({
queryKey: ['foo', ref('bar')],
})
expect(QueryCacheOrigin.prototype.find).toHaveBeenCalledWith({
queryKey: ['foo', 'bar'],
})
})
})
describe('findAll', () => {
it('should properly unwrap two parameters', () => {
const queryCache = new QueryCache()
queryCache.findAll({
queryKey: ['foo', ref('bar')],
})
expect(QueryCacheOrigin.prototype.findAll).toHaveBeenCalledWith({
queryKey: ['foo', 'bar'],
})
})
it('should default to empty filters', () => {
const queryCache = new QueryCache()
queryCache.findAll()
expect(QueryCacheOrigin.prototype.findAll).toHaveBeenCalledWith({})
})
})
})