Browse Source

proving HOC works with redux

Daniel Zlotin 6 years ago
parent
commit
bd8837a2ce
1 changed files with 19 additions and 0 deletions
  1. 19
    0
      integration/redux/Redux.test.js

+ 19
- 0
integration/redux/Redux.test.js View File

@@ -29,6 +29,25 @@ describe('redux support', () => {
29 29
     expect(tree.toJSON().children).toEqual(['no name']);
30 30
   });
31 31
 
32
+  it('passes props into wrapped components', () => {
33
+    const renderCountIncrement = jest.fn();
34
+
35
+    const HOC = class extends React.Component {
36
+      render() {
37
+        return (
38
+          <Provider store={store.reduxStore}>
39
+            <MyConnectedComponent {...this.props}/>
40
+          </Provider>
41
+        );
42
+      }
43
+    };
44
+    Navigation.registerComponent('ComponentName', () => HOC);
45
+
46
+    const tree = renderer.create(<HOC renderCountIncrement={renderCountIncrement}/>);
47
+    expect(tree.toJSON().children).toEqual(['no name']);
48
+    expect(renderCountIncrement).toHaveBeenCalledTimes(1);
49
+  });
50
+
32 51
   it('rerenders as a result of an underlying state change (by selector)', () => {
33 52
     const renderCountIncrement = jest.fn();
34 53
     const tree = renderer.create(