Skip to content

Instantly share code, notes, and snippets.

@vinayakhumberi
Created March 17, 2021 17:07
Show Gist options
  • Save vinayakhumberi/7fb4c76b8a3346371a1f254de78338dd to your computer and use it in GitHub Desktop.
Save vinayakhumberi/7fb4c76b8a3346371a1f254de78338dd to your computer and use it in GitHub Desktop.
jest.mock('react-redux', () => ({
connect: (mapStateToProps, mapDispatchToProps) => (reactComponent) => ({
mapStateToProps,
mapDispatchToProps: (dispatch = mockDispatch, ownProps) => mapDispatchToProps(dispatch, ownProps),
reactComponent,
mockDispatch: jest.fn((action) => action)
}),
Provider: ({children}) => children
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment