Skip to content

Commit f608036

Browse files
committed
test(components): store wrapper tests
1 parent 18b123f commit f608036

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/components/storeWrapper.spec.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import expect from 'expect';
2+
import { createStore } from 'redux';
3+
import wrapStore from '../../src/components/storeWrapper';
4+
5+
const mockStore = function(callback) {
6+
return {
7+
dispatch: (action) => {
8+
callback(action);
9+
},
10+
};
11+
};
12+
13+
14+
describe.only('storeWrapper', () => {
15+
it('should pass new state from provided store to ngReduxStore', () => {
16+
let dispatches = 0;
17+
const providedStore = createStore((state, action) => action.payload);
18+
const ngReduxStore = mockStore((action) => {
19+
dispatches++;
20+
expect(action.type).toEqual('@@NGREDUX_PASSTHROUGH');
21+
22+
if (action.payload) {
23+
expect(action.payload).toEqual('TEST DISPATCH');
24+
}
25+
});
26+
27+
const wrappedStore = wrapStore(providedStore, ngReduxStore);
28+
29+
providedStore.dispatch({
30+
type: 'TEST',
31+
payload: 'TEST DISPATCH'
32+
});
33+
34+
expect(dispatches).toEqual(2);
35+
});
36+
});

0 commit comments

Comments
 (0)