|  | 
|  | 1 | +/* eslint-env jest */ | 
|  | 2 | +import thunk from 'redux-thunk'; | 
|  | 3 | +import { registerMiddlewares } from '../../src'; | 
|  | 4 | +import actions from '../testingData/actions'; | 
|  | 5 | + | 
|  | 6 | +registerMiddlewares([thunk]); | 
|  | 7 | + | 
|  | 8 | +describe('jest', () => { | 
|  | 9 | + describe('toDispatchActionsWithState', () => { | 
|  | 10 | + it('should accept object', (done) => { | 
|  | 11 | + const state = { property: 'value' }; | 
|  | 12 | + expect(actions.actionCreatorWithGetState()) | 
|  | 13 | + .toDispatchActionsWithState(state, actions.actionWithGetState({ property: 'value' }), done); | 
|  | 14 | + }); | 
|  | 15 | + }); | 
|  | 16 | + | 
|  | 17 | + describe('.toDispatchActions', () => { | 
|  | 18 | + it('should accept single action', (done) => { | 
|  | 19 | + expect(actions.start()).toDispatchActions(actions.start(), done); | 
|  | 20 | + }); | 
|  | 21 | + | 
|  | 22 | + it('should accept array with one action', (done) => { | 
|  | 23 | + expect(actions.start()).toDispatchActions([actions.start()], done); | 
|  | 24 | + }); | 
|  | 25 | + | 
|  | 26 | + it('should accept array with multiple actions', (done) => { | 
|  | 27 | + expect(actions.asyncActionCreator()) | 
|  | 28 | + .toDispatchActions(actions.expectedActions, done); | 
|  | 29 | + }); | 
|  | 30 | + | 
|  | 31 | + it('should accept array with nested async action creators', (done) => { | 
|  | 32 | + expect(actions.parentAsyncActionCreator()) | 
|  | 33 | + .toDispatchActions(actions.expectedParentActions, done); | 
|  | 34 | + }); | 
|  | 35 | + }); | 
|  | 36 | + | 
|  | 37 | + describe('.toNotDispatchActions', () => { | 
|  | 38 | + it('should accept single action', (done) => { | 
|  | 39 | + expect(actions.start()).toNotDispatchActions(actions.anotherStart(), done); | 
|  | 40 | + }); | 
|  | 41 | + | 
|  | 42 | + it('should accept array with one action', (done) => { | 
|  | 43 | + expect(actions.start()).toNotDispatchActions([actions.anotherStart()], done); | 
|  | 44 | + }); | 
|  | 45 | + | 
|  | 46 | + it('should accept array with multiple actions', (done) => { | 
|  | 47 | + expect(actions.asyncActionCreator()) | 
|  | 48 | + .toNotDispatchActions(actions.anotherExpectedActions, done); | 
|  | 49 | + }); | 
|  | 50 | + | 
|  | 51 | + it('should accept array with nested async action creators', (done) => { | 
|  | 52 | + expect(actions.parentAsyncActionCreator()) | 
|  | 53 | + .toNotDispatchActions(actions.anotherParentExpectedActions, done); | 
|  | 54 | + }); | 
|  | 55 | + }); | 
|  | 56 | +}); | 
0 commit comments