Skip to content

Instantly share code, notes, and snippets.

@hjumeau
Created December 28, 2019 15:47
Show Gist options
  • Save hjumeau/1c44f4577907f052f4673cda508bf57f to your computer and use it in GitHub Desktop.
Save hjumeau/1c44f4577907f052f4673cda508bf57f to your computer and use it in GitHub Desktop.
A simple test helper - redux-form provider for enzyme mount component
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