@@ -2,9 +2,7 @@ import _ from 'lodash';
22import sinon from 'sinon' ;
33import faker from 'faker' ;
44import { 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
97describe ( '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' ) ;
0 commit comments