File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -10,9 +10,17 @@ function dispatchActions(expectedActions, done) {
1010 if ( this . obj instanceof ActionWithInitialState ) {
1111 const action = this . obj . action ;
1212 const state = this . obj . state ;
13- assertions . toDispatchActionsWithState ( state , action , expectedActions , done ) ;
13+ if ( this . flags . not ) {
14+ assertions . toNotDispatchActionsWithState ( state , action , expectedActions , done ) ;
15+ } else {
16+ assertions . toDispatchActionsWithState ( state , action , expectedActions , done ) ;
17+ }
1418 } else {
15- assertions . toDispatchActions ( this . obj , expectedActions , done ) ;
19+ if ( this . flags . not ) {
20+ assertions . toNotDispatchActions ( this . obj , expectedActions , done ) ;
21+ } else {
22+ assertions . toDispatchActions ( this . obj , expectedActions , done ) ;
23+ }
1624 }
1725}
1826
Original file line number Diff line number Diff line change @@ -41,4 +41,24 @@ describe('expect.js', () => {
4141 . to . dispatchActions ( actions . expectedParentActions , done ) ;
4242 } ) ;
4343 } ) ;
44+
45+ describe ( 'not.dispatchActions' , ( ) => {
46+ it ( 'should accept single action' , ( done ) => {
47+ expect ( actions . start ( ) ) . to . not . dispatchActions ( actions . anotherStart ( ) , done ) ;
48+ } ) ;
49+
50+ it ( 'should accept array with one action' , ( done ) => {
51+ expect ( actions . start ( ) ) . to . not . dispatchActions ( [ actions . anotherStart ( ) ] , done ) ;
52+ } ) ;
53+
54+ it ( 'should accept array with multiple actions' , ( done ) => {
55+ expect ( actions . asyncActionCreator ( ) )
56+ . to . not . dispatchActions ( actions . anotherExpectedActions , done ) ;
57+ } ) ;
58+
59+ it ( 'should accept array with nested async action creators' , ( done ) => {
60+ expect ( actions . parentAsyncActionCreator ( ) )
61+ . to . not . dispatchActions ( actions . anotherParentExpectedActions , done ) ;
62+ } ) ;
63+ } ) ;
4464} ) ;
You can’t perform that action at this time.
0 commit comments