Skip to content
This repository was archived by the owner on May 17, 2019. It is now read-only.

Commit 44ef0ac

Browse files
author
Choong Kim
committed
Update deps and node test to accommodate React Redux >=6
1 parent 78d1b7b commit 44ef0ac

File tree

3 files changed

+54
-39
lines changed

3 files changed

+54
-39
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,24 @@
4141
"eslint": "^5.16.0",
4242
"eslint-config-fusion": "^5.0.0",
4343
"eslint-plugin-cup": "^2.0.1",
44-
"eslint-plugin-flowtype": "^3.6.1",
44+
"eslint-plugin-flowtype": "^3.7.0",
4545
"eslint-plugin-import": "^2.17.2",
46-
"eslint-plugin-jest": "^22.4.1",
46+
"eslint-plugin-jest": "^22.5.1",
4747
"eslint-plugin-prettier": "^3.0.1",
48-
"eslint-plugin-react": "^7.12.4",
48+
"eslint-plugin-react": "^7.13.0",
4949
"eslint-plugin-react-hooks": "^1.6.0",
50-
"flow-bin": "^0.97.0",
50+
"flow-bin": "^0.98.0",
5151
"fusion-core": "^1.10.6",
5252
"fusion-plugin-universal-events": "^1.3.4",
5353
"fusion-react": "^2.0.0",
5454
"fusion-test-utils": "^1.4.1",
5555
"fusion-tokens": "^1.1.1",
56-
"nyc": "^14.0.0",
56+
"nyc": "^14.1.0",
5757
"prettier": "^1.17.0",
5858
"prop-types": "^15.7.2",
5959
"react": "^16.8.6",
6060
"react-dom": "^16.8.6",
61-
"react-redux": "^7.0.2",
61+
"react-redux": "^7.0.3",
6262
"react-test-renderer": "^16.8.6",
6363
"redux": "^4.0.1",
6464
"redux-reactors": "^1.0.3",

src/__tests__/index.node.js

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ test('withRPCRedux hoc', t => {
8484
const renderer = new ShallowRenderer();
8585
const expectedActions = ['TEST_START', 'TEST_SUCCESS'];
8686
const expectedPayloads = ['test-args', 'test-resolve'];
87+
const store = {
88+
dispatch(action) {
89+
t.equal(action.type, expectedActions.shift());
90+
t.equal(action.payload, expectedPayloads.shift());
91+
},
92+
getState() {},
93+
};
8794
renderer.render(React.createElement(Connected), {
8895
rpc: {
8996
request(method, args) {
@@ -92,21 +99,22 @@ test('withRPCRedux hoc', t => {
9299
return Promise.resolve('test-resolve');
93100
},
94101
},
95-
store: {
96-
dispatch(action) {
97-
t.equal(action.type, expectedActions.shift());
98-
t.equal(action.payload, expectedPayloads.shift());
99-
},
100-
getState() {},
101-
},
102+
store,
102103
});
103104
const rendered = renderer.getRenderOutput();
104-
t.equal(
105-
typeof rendered.props.test,
106-
'function',
107-
'passes the handler through to props'
108-
);
109-
rendered.props.test('test-args');
105+
106+
if (rendered.props.test) {
107+
t.equal(
108+
typeof rendered.props.test,
109+
'function',
110+
'passes the handler through to props'
111+
);
112+
rendered.props.test('test-args');
113+
} else {
114+
const {test: handler} = rendered.props.children({store}).props;
115+
t.equal(typeof test, 'function', 'passes the handler through to props');
116+
handler('test-args');
117+
}
110118
t.end();
111119
});
112120

@@ -124,6 +132,13 @@ test('withRPCReactor hoc', t => {
124132
const renderer = new ShallowRenderer();
125133
const expectedActions = ['TEST_START', 'TEST_SUCCESS'];
126134
const expectedPayloads = ['test-args', 'test-resolve'];
135+
const store = {
136+
dispatch(action) {
137+
t.equal(action.type, expectedActions.shift());
138+
t.equal(action.payload, expectedPayloads.shift());
139+
},
140+
getState() {},
141+
};
127142
renderer.render(React.createElement(Connected), {
128143
rpc: {
129144
request(method, args) {
@@ -132,21 +147,21 @@ test('withRPCReactor hoc', t => {
132147
return Promise.resolve('test-resolve');
133148
},
134149
},
135-
store: {
136-
dispatch(action) {
137-
t.equal(action.type, expectedActions.shift());
138-
t.equal(action.payload, expectedPayloads.shift());
139-
},
140-
getState() {},
141-
},
150+
store,
142151
});
143152
const rendered = renderer.getRenderOutput();
144-
t.equal(
145-
typeof rendered.props.test,
146-
'function',
147-
'passes the handler through to props'
148-
);
149-
rendered.props.test('test-args');
153+
if (rendered.props.test) {
154+
t.equal(
155+
typeof rendered.props.test,
156+
'function',
157+
'passes the handler through to props'
158+
);
159+
rendered.props.test('test-args');
160+
} else {
161+
const {test: handler} = rendered.props.children({store}).props;
162+
t.equal(typeof test, 'function', 'passes the handler through to props');
163+
handler('test-args');
164+
}
150165
t.end();
151166
});
152167

yarn.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -718,9 +718,9 @@
718718
"@babel/plugin-transform-react-jsx-source" "^7.0.0"
719719

720720
"@babel/runtime@^7.4.3":
721-
version "7.4.3"
722-
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.3.tgz#79888e452034223ad9609187a0ad1fe0d2ad4bdc"
723-
integrity sha512-9lsJwJLxDh/T3Q3SZszfWOTkk3pHbkmH+3KY+zwIDmsNlxsumuhS2TH3NIpktU4kNvfzy+k3eLT7aTJSPTo0OA==
721+
version "7.4.4"
722+
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.4.4.tgz#dc2e34982eb236803aa27a07fea6857af1b9171d"
723+
integrity sha512-w0+uT71b6Yi7i5SE0co4NioIpSYS6lLiXvCzWzGSKvpK5vdQtCbICHMj+gbAKAOtxiV6HsVh/MBdaF9EQ6faSg==
724724
dependencies:
725725
regenerator-runtime "^0.13.2"
726726

@@ -4878,10 +4878,10 @@ react-is@^16.8.1, react-is@^16.8.6:
48784878
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16"
48794879
integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA==
48804880

4881-
react-redux@^7.0.2:
4882-
version "7.0.2"
4883-
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.0.2.tgz#34b280a3482aaf60e7d4a504b1295165cbe6b86a"
4884-
integrity sha512-uKRuMgQt8dWbcz0U75oFK5tDo3boyAKrqvf/j94vpqRFFZfyDDy4kofUgloFIGyuKTq2Zz51zgK9RzOTFXk5ew==
4881+
react-redux@^7.0.3:
4882+
version "7.0.3"
4883+
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-7.0.3.tgz#983c5a6de81cb1e696bd1c090ba826545f9170f1"
4884+
integrity sha512-vYZA7ftOYlDk3NetitsI7fLjryt/widNl1SLXYvFenIpm7vjb4ryK0EeFrgn62usg5fYkyIAWNUPKnwWPevKLg==
48854885
dependencies:
48864886
"@babel/runtime" "^7.4.3"
48874887
hoist-non-react-statics "^3.3.0"

0 commit comments

Comments
 (0)