File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -668,6 +668,37 @@ describe('Modules', () => {
668
668
store . state
669
669
)
670
670
} )
671
+
672
+ it ( 'action before/after subscribers' , ( done ) => {
673
+ const beforeSpy = jasmine . createSpy ( )
674
+ const afterSpy = jasmine . createSpy ( )
675
+ const store = new Vuex . Store ( {
676
+ actions : {
677
+ [ TEST ] : ( ) => new Promise ( resolve => resolve ( ) )
678
+ } ,
679
+ plugins : [
680
+ store => {
681
+ store . subscribeAction ( {
682
+ before : beforeSpy ,
683
+ after : afterSpy
684
+ } )
685
+ }
686
+ ]
687
+ } )
688
+ store . dispatch ( TEST , 2 )
689
+ expect ( beforeSpy ) . toHaveBeenCalledWith (
690
+ { type : TEST , payload : 2 } ,
691
+ store . state
692
+ )
693
+ expect ( afterSpy ) . not . toHaveBeenCalled ( )
694
+ Vue . nextTick ( ( ) => {
695
+ expect ( afterSpy ) . toHaveBeenCalledWith (
696
+ { type : TEST , payload : 2 } ,
697
+ store . state
698
+ )
699
+ done ( )
700
+ } )
701
+ } )
671
702
} )
672
703
673
704
it ( 'asserts a mutation should be a function' , ( ) => {
You can’t perform that action at this time.
0 commit comments