Skip to content

Instantly share code, notes, and snippets.

@rbinksy
Created March 4, 2020 08:39
Show Gist options
  • Save rbinksy/d14e1c85c70c4e122bb5a48bc751040e to your computer and use it in GitHub Desktop.
Save rbinksy/d14e1c85c70c4e122bb5a48bc751040e to your computer and use it in GitHub Desktop.
import React from 'react';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import { render } from '@testing-library/react';
import reducer from '../../reducers';
export const renderWithRedux = (component, initialState) => {
const store = createStore(reducer, initialState);
return {
...render(<Provider store={store}>{component}</Provider>),
store
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment