@@ -8,12 +8,16 @@ describe('Connector', () => {
88 let store ;
99 let connect ;
1010 let targetObj ;
11+ let defaultState ;
1112
1213 beforeEach ( ( ) => {
13- store = createStore ( ( state , action ) => ( {
14+ defaultState = {
1415 foo : 'bar' ,
15- baz : action . payload
16- } ) ) ;
16+ baz : - 1
17+ } ;
18+ store = createStore ( ( state = defaultState , action ) => {
19+ return { ...state , baz : action . payload } ;
20+ } ) ;
1721 targetObj = { } ;
1822 connect = Connector ( store ) ;
1923 } ) ;
@@ -45,8 +49,8 @@ describe('Connector', () => {
4549 connect ( state => state ) ( targetObj ) ;
4650 store . dispatch ( { type : 'ACTION' , payload : 0 } ) ;
4751 expect ( targetObj . baz ) . toBe ( 0 ) ;
48- store . dispatch ( { type : 'ACTION' , payload : 1 } ) ;
49- expect ( targetObj . baz ) . toBe ( 1 ) ;
52+ store . dispatch ( { type : 'ACTION' , payload : 7 } ) ;
53+ expect ( targetObj . baz ) . toBe ( 7 ) ;
5054 } ) ;
5155
5256 it ( 'Should prevent unnecessary updates when state does not change (shallowly)' , ( ) => {
@@ -90,11 +94,4 @@ describe('Connector', () => {
9094 expect ( receivedDispatch ) . toBe ( store . dispatch ) ;
9195 } ) ;
9296
93- it ( 'Should call target (Function) with mapStateToTarget and mapDispatchToTarget results ' , ( ) => {
94-
95- //let targetFunc = sinon.spy();
96- //connect(targetFunc, state => state.pojo);
97- expect ( false ) . toBe ( true ) ;
98- } ) ;
99-
10097} ) ;
0 commit comments