File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export default function Connector(store) {
15
15
16
16
let finalMapStateToTarget = mapStateToTarget || defaultMapStateToTarget ;
17
17
18
- const finalMapDispatchToTarget = isPlainObject ( mapDispatchToTarget ) ?
18
+ const finalMapDispatchToTarget = isObject ( mapDispatchToTarget ) && ! isFunction ( mapDispatchToTarget ) ?
19
19
wrapActionCreators ( mapDispatchToTarget ) :
20
20
mapDispatchToTarget || defaultMapDispatchToTarget ;
21
21
@@ -25,7 +25,7 @@ export default function Connector(store) {
25
25
) ;
26
26
27
27
invariant (
28
- isPlainObject ( finalMapDispatchToTarget ) || isFunction ( finalMapDispatchToTarget ) ,
28
+ isObject ( finalMapDispatchToTarget ) || isFunction ( finalMapDispatchToTarget ) ,
29
29
'mapDispatchToTarget must be a plain Object or a Function. Instead received %s.' , finalMapDispatchToTarget
30
30
) ;
31
31
Original file line number Diff line number Diff line change @@ -114,6 +114,15 @@ describe('Connector', () => {
114
114
expect ( receivedDispatch ) . toBe ( store . dispatch ) ;
115
115
} ) ;
116
116
117
+ it ( 'Should allow ES6 modules' , ( ) => {
118
+ // The tests are run in Node, so we are unable to use actual ES6 modules. We get quite
119
+ // close by emulating it
120
+ class FakeModule { } ;
121
+ const fakeModule = new FakeModule ( ) ;
122
+ fakeModule . prop = ( ) => { } ;
123
+ expect ( ( ) => connect ( ( ) => ( { } ) , fakeModule ) ( targetObj ) ) . toNotThrow ( ) ;
124
+ } ) ;
125
+
117
126
it ( 'Should provide state slice, bound actions and previous state slice to target (function)' , ( ) => {
118
127
const targetFunc = sinon . spy ( ) ;
119
128
You can’t perform that action at this time.
0 commit comments