Want to test two redux related components? You should test each component separately for unit testing.
Component1: You should test that when you click a button or something, that Component1 is dispatching the right action.
Component2: You should test that when you provide the props, it behaves as excepted.
You can export the Component2 separately to unit test it.
1 2 3 4 5 6 7 8 9 10 11 12 13 | // Component2.js export class Component2 extends React.component { render() { return ( <Component3 props1={this.props.props1} /> ) } } export default connect( state => ({ props1: state.reducer1.props1 }), {} )(Component2) |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.