@@ -71,28 +71,28 @@ describe('when getting scheduler', () => {
7171 jest . restoreAllMocks ( ) ;
7272 } ) ;
7373
74- test ( 'reschedule after minutes zero' , ( ) => {
74+ test ( 'reschedule after minutes zero' , async ( ) => {
7575 // if called with zero, should call cron with a 1
76- rescheduleAfterMinutes ( session , 'arn:goes:here' , 0 , handlerRequest ) ;
76+ await rescheduleAfterMinutes ( session , 'arn:goes:here' , 0 , handlerRequest ) ;
7777
7878 expect ( cwEvents ) . toHaveBeenCalledTimes ( 1 ) ;
7979 expect ( cwEvents ) . toHaveBeenCalledWith ( 'CloudWatchEvents' ) ;
8080 expect ( spyMinToCron ) . toHaveBeenCalledTimes ( 1 ) ;
8181 expect ( spyMinToCron ) . toHaveBeenCalledWith ( 1 ) ;
8282 } ) ;
8383
84- test ( 'reschedule after minutes not zero' , ( ) => {
84+ test ( 'reschedule after minutes not zero' , async ( ) => {
8585 // if called with another number, should use that
86- rescheduleAfterMinutes ( session , 'arn:goes:here' , 2 , handlerRequest ) ;
86+ await rescheduleAfterMinutes ( session , 'arn:goes:here' , 2 , handlerRequest ) ;
8787
8888 expect ( cwEvents ) . toHaveBeenCalledTimes ( 1 ) ;
8989 expect ( cwEvents ) . toHaveBeenCalledWith ( 'CloudWatchEvents' ) ;
9090 expect ( spyMinToCron ) . toHaveBeenCalledTimes ( 1 ) ;
9191 expect ( spyMinToCron ) . toHaveBeenCalledWith ( 2 ) ;
9292 } ) ;
9393
94- test ( 'reschedule after minutes success' , ( ) => {
95- rescheduleAfterMinutes ( session , 'arn:goes:here' , 2 , handlerRequest ) ;
94+ test ( 'reschedule after minutes success' , async ( ) => {
95+ await rescheduleAfterMinutes ( session , 'arn:goes:here' , 2 , handlerRequest ) ;
9696
9797 expect ( cwEvents ) . toHaveBeenCalledTimes ( 1 ) ;
9898 expect ( cwEvents ) . toHaveBeenCalledWith ( 'CloudWatchEvents' ) ;
@@ -115,9 +115,9 @@ describe('when getting scheduler', () => {
115115 } ) ;
116116 } ) ;
117117
118- test ( 'cleanup cloudwatch events empty' , ( ) => {
118+ test ( 'cleanup cloudwatch events empty' , async ( ) => {
119119 // cleanup should silently pass if rule/target are empty
120- cleanupCloudwatchEvents ( session , '' , '' ) ;
120+ await cleanupCloudwatchEvents ( session , '' , '' ) ;
121121
122122 expect ( cwEvents ) . toHaveBeenCalledTimes ( 1 ) ;
123123 expect ( cwEvents ) . toHaveBeenCalledWith ( 'CloudWatchEvents' ) ;
@@ -126,10 +126,10 @@ describe('when getting scheduler', () => {
126126 expect ( spyConsoleError ) . toHaveBeenCalledTimes ( 0 ) ;
127127 } ) ;
128128
129- test ( 'cleanup cloudwatch events success' , ( ) => {
129+ test ( 'cleanup cloudwatch events success' , async ( ) => {
130130 // when rule_name and target_id are provided we should call events client and not
131131 // log errors if the deletion succeeds
132- cleanupCloudwatchEvents ( session , 'rulename' , 'targetid' ) ;
132+ await cleanupCloudwatchEvents ( session , 'rulename' , 'targetid' ) ;
133133
134134 expect ( spyConsoleError ) . toHaveBeenCalledTimes ( 0 ) ;
135135 expect ( cwEvents ) . toHaveBeenCalledTimes ( 1 ) ;
@@ -140,13 +140,13 @@ describe('when getting scheduler', () => {
140140 expect ( spyConsoleError ) . toHaveBeenCalledTimes ( 0 ) ;
141141 } ) ;
142142
143- test ( 'cleanup cloudwatch events client error' , ( ) => {
143+ test ( 'cleanup cloudwatch events client error' , async ( ) => {
144144 // cleanup should catch and log client failures
145145 const error = awsUtil . error ( new Error ( ) , { code : '1' } ) ;
146146 mockRemoveTargets . mockImplementation ( ( ) => { throw error } ) ;
147147 mockDeleteRule . mockImplementation ( ( ) => { throw error } ) ;
148148
149- cleanupCloudwatchEvents ( session , 'rulename' , 'targetid' ) ;
149+ await cleanupCloudwatchEvents ( session , 'rulename' , 'targetid' ) ;
150150
151151 expect ( cwEvents ) . toHaveBeenCalledTimes ( 1 ) ;
152152 expect ( cwEvents ) . toHaveBeenCalledWith ( 'CloudWatchEvents' ) ;
0 commit comments