Skip to content

Commit 1db6450

Browse files
committed
Update rewire
1 parent 95aa1a8 commit 1db6450

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

app/client/helpers/fetch-data-test.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import _ from 'lodash';
22
import sinon from 'sinon';
33
import faker from 'faker';
44
import { assert } from 'chai';
5-
import rewire from 'rewire';
6-
7-
const Module = rewire('./fetch-data');
5+
import { serverFetchData, clientFetchData, getLocals, __RewireAPI__ as Module } from './fetch-data';
86

97
describe('Helper: fetchData', () => {
108
it('should be an object', () => {
@@ -29,7 +27,7 @@ describe('Helper: fetchData', () => {
2927

3028
Module.__Rewire__('trigger', trigger);
3129

32-
Module.serverFetchData(renderProps, store);
30+
serverFetchData(renderProps, store);
3331
});
3432

3533
after(() => {
@@ -86,7 +84,7 @@ describe('Helper: fetchData', () => {
8684

8785
Module.__Rewire__('match', match);
8886

89-
Module.clientFetchData(routes, store);
87+
clientFetchData(routes, store);
9088
sinon.assert.calledWith(navigateToSpy, '/500.html');
9189

9290
Module.__ResetDependency__('match');
@@ -99,7 +97,7 @@ describe('Helper: fetchData', () => {
9997

10098
Module.__Rewire__('match', match);
10199

102-
Module.clientFetchData(routes, store);
100+
clientFetchData(routes, store);
103101
sinon.assert.calledWith(navigateToSpy, '/hello-world.html');
104102

105103
Module.__ResetDependency__('match');
@@ -119,9 +117,9 @@ describe('Helper: fetchData', () => {
119117

120118
Module.__Rewire__('match', match);
121119

122-
Module.clientFetchData(routes, store);
120+
clientFetchData(routes, store);
123121
sinon.assert.calledWith(
124-
triggerSpy, 'fetchData', renderProps.components, Module.getLocals(store, renderProps)
122+
triggerSpy, 'fetchData', renderProps.components, getLocals(store, renderProps)
125123
);
126124

127125
Module.__ResetDependency__('match');
@@ -134,7 +132,7 @@ describe('Helper: fetchData', () => {
134132

135133
Module.__Rewire__('match', match);
136134

137-
Module.clientFetchData(routes, store);
135+
clientFetchData(routes, store);
138136
sinon.assert.calledWith(navigateToSpy, '/404.html');
139137

140138
Module.__ResetDependency__('match');

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"react-transform-hmr": "^1.0.4",
2121
"redbox-react": "^1.2.10",
2222
"regenerator-runtime": "^0.9.5",
23-
"rewire": "^2.5.2",
2423
"sinon": "^1.17.4",
2524
"supertest": "^1.2.0"
2625
},

0 commit comments

Comments
 (0)