@@ -88,7 +88,7 @@ describe("TwilioNotifyer", () => {
88
88
mockRes . send . mockClear ( ) ;
89
89
} ) ;
90
90
91
- it ( "should handle unknown user replies" , ( ) => {
91
+ it ( "should handle unknown user replies" , async ( ) => {
92
92
const req : Partial < express . Request > = {
93
93
body : {
94
94
Body : "this is a fake message that means nothing" ,
@@ -97,23 +97,23 @@ describe("TwilioNotifyer", () => {
97
97
} ;
98
98
99
99
// @ts -expect-error - it's not the exact same type, but I don't care
100
- notifs . handleUserReply ( req , mockRes ) ;
100
+ await notifs . handleUserReply ( req , mockRes ) ;
101
101
expect ( mockRes . send . mock . calls [ 0 ] [ 0 ] ) . toMatch (
102
102
/ f a i l e d t o u n d e r s t a n d y o u r m e s s a g e / i,
103
103
) ;
104
104
} ) ;
105
105
106
- it ( "should handle a 'Stop all' request" , ( ) => {
106
+ it ( "should handle a 'Stop all' request" , async ( ) => {
107
107
const req : Partial < express . Request > = {
108
108
body : {
109
109
Body : notifs . TWILIO_REPLIES [ "STOP_ALL" ] ,
110
110
From : "911" ,
111
111
} ,
112
112
} ;
113
113
114
- const deleteSpy = jest . spyOn ( notificationsManager , "deleteAllUserSubscriptions" ) ;
114
+ const deleteSpy = jest . spyOn ( notificationsManager , "deleteAllUserSubscriptions" ) . mockResolvedValue ( undefined ) ; ;
115
115
// @ts -expect-error - it's not the exact same type, but I don't care
116
- notifs . handleUserReply ( req , mockRes ) ;
116
+ await notifs . handleUserReply ( req , mockRes ) ;
117
117
expect ( deleteSpy ) . toHaveBeenCalledWith ( "911" ) ;
118
118
expect ( mockRes . send . mock . calls [ 0 ] [ 0 ] ) . toMatch ( / h a v e b e e n r e m o v e d / i) ;
119
119
} ) ;
0 commit comments