@@ -19,14 +19,14 @@ import {
19
19
ANY ,
20
20
getSerializedHeaders ,
21
21
setupApiStore ,
22
+ waitMs ,
22
23
} from '../../tests/utils/helpers'
23
24
import { expectExactType , expectType } from '../../tests/utils/typeTestHelpers'
24
- import { delay } from '../../utils'
25
25
import type {
26
26
DefinitionsFromApi ,
27
27
OverrideResultType ,
28
28
TagTypesFromApi ,
29
- } from '.. /endpointDefinitions'
29
+ } from '@reduxjs/toolkit/dist/query /endpointDefinitions'
30
30
import { server } from './mocks/server'
31
31
32
32
beforeAll ( ( ) => {
@@ -186,7 +186,7 @@ describe('wrong tagTypes log errors', () => {
186
186
store . dispatch ( api . endpoints [ endpoint ] . initiate ( ) )
187
187
let result : { status : string }
188
188
do {
189
- await delay ( 5 )
189
+ await waitMs ( 5 )
190
190
// @ts -ignore
191
191
result = api . endpoints [ endpoint ] . select ( ) ( store . getState ( ) )
192
192
} while ( result . status === 'pending' )
@@ -461,11 +461,11 @@ describe('endpoint definition typings', () => {
461
461
} )
462
462
463
463
storeRef . store . dispatch ( api . endpoints . query1 . initiate ( 'in1' ) )
464
- await delay ( 1 )
464
+ await waitMs ( 1 )
465
465
expect ( spy ) . not . toHaveBeenCalled ( )
466
466
467
467
storeRef . store . dispatch ( api . endpoints . query2 . initiate ( 'in2' ) )
468
- await delay ( 1 )
468
+ await waitMs ( 1 )
469
469
expect ( spy ) . toHaveBeenCalledWith (
470
470
"Tag type 'missing' was used, but not specified in `tagTypes`!"
471
471
)
@@ -805,15 +805,15 @@ describe('query endpoint lifecycles - onStart, onSuccess, onError', () => {
805
805
const failAttempt = storeRef . store . dispatch ( api . endpoints . query . initiate ( ) )
806
806
expect ( storeRef . store . getState ( ) . testReducer . count ) . toBe ( 0 )
807
807
await failAttempt
808
- await delay ( 10 )
808
+ await waitMs ( 10 )
809
809
expect ( storeRef . store . getState ( ) . testReducer . count ) . toBe ( - 1 )
810
810
811
811
const successAttempt = storeRef . store . dispatch (
812
812
api . endpoints . query . initiate ( )
813
813
)
814
814
expect ( storeRef . store . getState ( ) . testReducer . count ) . toBe ( 0 )
815
815
await successAttempt
816
- await delay ( 10 )
816
+ await waitMs ( 10 )
817
817
expect ( storeRef . store . getState ( ) . testReducer . count ) . toBe ( 1 )
818
818
} )
819
819
0 commit comments