File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments