Skip to content

Commit 02d3175

Browse files
committed
Tests
1 parent a0b0b52 commit 02d3175

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

test/components/connector.spec.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)