File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
packages/toolkit/src/tests/utils Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -7,11 +7,10 @@ import type {
7
7
} from '@reduxjs/toolkit'
8
8
import { configureStore } from '@reduxjs/toolkit'
9
9
import { setupListeners } from '@reduxjs/toolkit/query'
10
+ import { act , cleanup } from '@testing-library/react'
10
11
import { useCallback , useEffect , useRef } from 'react'
11
-
12
12
import { Provider } from 'react-redux'
13
-
14
- import { act , cleanup } from '@testing-library/react'
13
+ import type { AnyObject } from '../../tsHelpers'
15
14
16
15
export const ANY = 0 as any
17
16
@@ -215,3 +214,24 @@ export function setupApiStore<
215
214
216
215
return refObj
217
216
}
217
+
218
+ export const isObject = ( value : unknown ) : value is AnyObject => {
219
+ return typeof value === 'object' && value != null
220
+ }
221
+
222
+ export const hasBodyAndHeaders = (
223
+ request : unknown ,
224
+ ) : request is {
225
+ body : any
226
+ headers : {
227
+ 'content-type' : string
228
+ }
229
+ } => {
230
+ return (
231
+ isObject ( request ) &&
232
+ 'headers' in request &&
233
+ isObject ( request . headers ) &&
234
+ 'content-type' in request . headers &&
235
+ 'body' in request
236
+ )
237
+ }
You can’t perform that action at this time.
0 commit comments