Created
December 28, 2019 15:47
-
-
Save hjumeau/1c44f4577907f052f4673cda508bf57f to your computer and use it in GitHub Desktop.
A simple test helper - redux-form provider for enzyme mount component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { mount } from "enzyme"; | |
import { Provider } from "react-redux"; | |
import { createStore } from "redux"; | |
import { reducer as formReducer } from "redux-form"; | |
const store = createStore(() => ({ | |
form: formReducer, | |
})); | |
const withProviders = node => ( | |
<Provider store={store}> | |
{node} | |
</Provider> | |
); | |
export const mountWithProviders = (node, options) => | |
mount(withProviders(node), options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment