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 {
77} from '@reduxjs/toolkit'
88import { configureStore } from '@reduxjs/toolkit'
99import { setupListeners } from '@reduxjs/toolkit/query'
10+ import { act , cleanup } from '@testing-library/react'
1011import { useCallback , useEffect , useRef } from 'react'
11-
1212import { Provider } from 'react-redux'
13-
14- import { act , cleanup } from '@testing-library/react'
13+ import type { AnyObject } from '../../tsHelpers'
1514
1615export const ANY = 0 as any
1716
@@ -215,3 +214,24 @@ export function setupApiStore<
215214
216215 return refObj
217216}
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