Download react-query/packages/vue-query/src/__tests__/queryCache.test.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/vue-query/src/__tests__/queryCache.test.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/vue-query/src/__tests__/queryCache.test.ts
-
curl -L -o queryCache.test.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/packages/vue-query/src/__tests__/queryCache.test.ts
1.21 kB
| import { beforeAll, describe, expect, test, 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', () => { | |
| test('should properly unwrap parameters', () => { | |
| const queryCache = new QueryCache() | |
| queryCache.find({ | |
| queryKey: ['foo', ref('bar')], | |
| }) | |
| expect(QueryCacheOrigin.prototype.find).toBeCalledWith({ | |
| queryKey: ['foo', 'bar'], | |
| }) | |
| }) | |
| }) | |
| describe('findAll', () => { | |
| test('should properly unwrap two parameters', () => { | |
| const queryCache = new QueryCache() | |
| queryCache.findAll({ | |
| queryKey: ['foo', ref('bar')], | |
| }) | |
| expect(QueryCacheOrigin.prototype.findAll).toBeCalledWith({ | |
| queryKey: ['foo', 'bar'], | |
| }) | |
| }) | |
| test('should default to empty filters', () => { | |
| const queryCache = new QueryCache() | |
| queryCache.findAll() | |
| expect(QueryCacheOrigin.prototype.findAll).toBeCalledWith({}) | |
| }) | |
| }) | |
| }) | |