|
1 | | -import { |
2 | | - afterEach, |
3 | | - beforeEach, |
4 | | - describe, |
5 | | - expect, |
6 | | - expectTypeOf, |
7 | | - it, |
8 | | - vi, |
9 | | -} from 'vitest' |
| 1 | +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' |
10 | 2 | import { fireEvent, render } from '@testing-library/react' |
11 | 3 | import * as React from 'react' |
12 | 4 | import { useIsMutating, useMutationState } from '../useMutationState' |
13 | 5 | import { useMutation } from '../useMutation' |
14 | | -import { |
15 | | - createQueryClient, |
16 | | - doNotExecute, |
17 | | - renderWithClient, |
18 | | - sleep, |
19 | | -} from './utils' |
20 | | -import type { MutationState, MutationStatus } from '@tanstack/query-core' |
| 6 | +import { createQueryClient, renderWithClient, sleep } from './utils' |
21 | 7 |
|
22 | 8 | describe('useIsMutating', () => { |
23 | 9 | beforeEach(() => { |
@@ -182,27 +168,6 @@ describe('useIsMutating', () => { |
182 | 168 | }) |
183 | 169 |
|
184 | 170 | describe('useMutationState', () => { |
185 | | - describe('types', () => { |
186 | | - it('should default to QueryState', () => { |
187 | | - doNotExecute(() => { |
188 | | - const result = useMutationState({ |
189 | | - filters: { status: 'pending' }, |
190 | | - }) |
191 | | - |
192 | | - expectTypeOf(result).toEqualTypeOf<Array<MutationState>>() |
193 | | - }) |
194 | | - }) |
195 | | - it('should infer with select', () => { |
196 | | - doNotExecute(() => { |
197 | | - const result = useMutationState({ |
198 | | - filters: { status: 'pending' }, |
199 | | - select: (mutation) => mutation.state.status, |
200 | | - }) |
201 | | - |
202 | | - expectTypeOf(result).toEqualTypeOf<Array<MutationStatus>>() |
203 | | - }) |
204 | | - }) |
205 | | - }) |
206 | 171 | it('should return variables after calling mutate', async () => { |
207 | 172 | const queryClient = createQueryClient() |
208 | 173 | const variables: Array<Array<unknown>> = [] |
|
0 commit comments