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 } ) => ( < Provider store = { store } > { children } < /Provider>); return { ... store , ProviderWithStore } ; } ;