mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-09-11 13:56:29 +02:00
Initial commit
This commit is contained in:
16
src/utils/mockStore.tsx
Normal file
16
src/utils/mockStore.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ReactNode } from "react"
|
||||
import { Provider } from "react-redux"
|
||||
import thunk from "redux-thunk"
|
||||
import configurecreateMockStore from "redux-mock-store"
|
||||
|
||||
export default (obj = {}): Record<string, any> => {
|
||||
const store = configurecreateMockStore([thunk])(obj)
|
||||
const originalDispatch = store.dispatch
|
||||
store.dispatch = jest.fn(originalDispatch)
|
||||
|
||||
const ProviderWithStore = ({ children }: { children: ReactNode }) => (
|
||||
<Provider store={store}>{children}</Provider>
|
||||
)
|
||||
|
||||
return { ...store, ProviderWithStore }
|
||||
}
|
Reference in New Issue
Block a user