Spaces:
Sleeping
Sleeping
Download node_modules/@reduxjs/toolkit/src/query/tests/cacheLifecycle.test-d.ts from Scribbler310/gs-port: direct link, hf CLI and curl.
- Browser
- Download file 936 Bytes
-
https://huggingface.co/spaces/Scribbler310/gs-port/resolve/main/node_modules/%40reduxjs/toolkit/src/query/tests/cacheLifecycle.test-d.ts
- Command line
-
hf download hf://spaces/Scribbler310/gs-port/node_modules/@reduxjs/toolkit/src/query/tests/cacheLifecycle.test-d.ts
-
curl -L -o cacheLifecycle.test-d.ts https://huggingface.co/spaces/Scribbler310/gs-port/resolve/main/node_modules/%40reduxjs/toolkit/src/query/tests/cacheLifecycle.test-d.ts
936 Bytes
| import type { FetchBaseQueryMeta } from '@reduxjs/toolkit/query' | |
| import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query' | |
| const api = createApi({ | |
| baseQuery: fetchBaseQuery({ baseUrl: 'https://example.com' }), | |
| endpoints: () => ({}), | |
| }) | |
| describe('type tests', () => { | |
| test(`mutation: await cacheDataLoaded, await cacheEntryRemoved (success)`, () => { | |
| const extended = api.injectEndpoints({ | |
| overrideExisting: true, | |
| endpoints: (build) => ({ | |
| injected: build.mutation<number, string>({ | |
| query: () => '/success', | |
| async onCacheEntryAdded( | |
| arg, | |
| { dispatch, getState, cacheEntryRemoved, cacheDataLoaded }, | |
| ) { | |
| const firstValue = await cacheDataLoaded | |
| expectTypeOf(firstValue).toMatchTypeOf<{ | |
| data: number | |
| meta?: FetchBaseQueryMeta | |
| }>() | |
| }, | |
| }), | |
| }), | |
| }) | |
| }) | |
| }) | |