@@ -12,7 +12,6 @@ import blanket from 'blanket' // eslint-disable-line
12
12
import loader from './index'
13
13
import TailSpin from './TailSpin'
14
14
15
-
16
15
const Component = ( ) => < div />
17
16
const LoadingIndicator = ( ) => < div />
18
17
const getWrapped = ( config , props ) => {
@@ -151,13 +150,16 @@ describe('react-loader', () => {
151
150
// Mount
152
151
const loadProp = spy ( ( ) => { } )
153
152
const loadParam = spy ( ( ) => { } )
154
- const loaded = getWrapped ( { load : loadParam } , { load : loadProp } )
153
+ const props = { prop1 : 'prop1' , load : loadProp }
154
+ const loaded = getWrapped ( { load : loadParam } , props )
155
155
156
156
// Load function is called
157
157
// Graphic component isn't called
158
158
// Loader should be Dots
159
159
loadProp . should . have . been . called . once
160
+ loadProp . should . have . been . called . with ( props )
160
161
loadParam . should . have . been . called . once
162
+ loadParam . should . have . been . called . with ( props )
161
163
expect ( loaded . find ( Component ) . node ) . to . be . undefined
162
164
loaded . find ( TailSpin ) . node . should . exists
163
165
} )
@@ -166,12 +168,14 @@ describe('react-loader', () => {
166
168
// Mount
167
169
const loadProp = spy ( ( ) => { } )
168
170
const loadPropName = 'customLoadFunction'
169
- const loaded = getWrapped ( { load : loadPropName } , { [ loadPropName ] : loadProp } )
171
+ const props = { prop1 : 'prop1' , [ loadPropName ] : loadProp }
172
+ const loaded = getWrapped ( { load : loadPropName } , props )
170
173
171
174
// Load function is called
172
175
// Graphic component isn't called
173
176
// Loader should be Dots
174
177
loadProp . should . have . been . called . once
178
+ loadProp . should . have . been . called . with ( props )
175
179
expect ( loaded . find ( Component ) . node ) . to . be . undefined
176
180
loaded . find ( TailSpin ) . node . should . exists
177
181
} )
0 commit comments