react-code-dataset / react-query /packages /angular-query-experimental /src /__tests__ /inject-mutation-state.test-d.ts
| import { describe, expectTypeOf, it } from 'vitest' | |
| import { injectMutationState } from '..' | |
| import type { MutationState, MutationStatus } from '..' | |
| describe('injectMutationState', () => { | |
| it('should default to QueryState', () => { | |
| const result = injectMutationState(() => ({ | |
| filters: { status: 'pending' }, | |
| })) | |
| expectTypeOf(result()).toEqualTypeOf<Array<MutationState>>() | |
| }) | |
| it('should infer with select', () => { | |
| const result = injectMutationState(() => ({ | |
| filters: { status: 'pending' }, | |
| select: (mutation) => mutation.state.status, | |
| })) | |
| expectTypeOf(result()).toEqualTypeOf<Array<MutationStatus>>() | |
| }) | |
| }) | |