@@ -59,6 +59,7 @@ async function createSection(
59
59
}
60
60
61
61
const mockSendNotificationText = jest . fn ( ( ) => {
62
+ console . log ( "I SHOULD BE CALLED" ) ;
62
63
return Promise . resolve ( ) ;
63
64
} ) ;
64
65
@@ -216,11 +217,12 @@ describe("Notifyer", () => {
216
217
let notificationInfo : NotificationInfo ;
217
218
let courseHashToUsers : Record < string , User [ ] > ;
218
219
let sectionHashToUsers : Record < string , User [ ] > ;
219
- it ( "does not send anything where there are no updated courses and sections" , ( ) => {
220
+ it ( "does not send anything where there are no updated courses and sections" , async ( ) => {
220
221
notificationInfo = { updatedCourses : [ ] , updatedSections : [ ] } ;
221
222
courseHashToUsers = { } ;
222
223
sectionHashToUsers = { } ;
223
- sendNotifications (
224
+
225
+ await sendNotifications (
224
226
notificationInfo ,
225
227
courseHashToUsers ,
226
228
sectionHashToUsers
@@ -294,14 +296,12 @@ describe("Notifyer", () => {
294
296
data : {
295
297
courseHash : "neu.edu/202210/ARTF/1122" ,
296
298
userId : 1 ,
297
- notifCount : 0 ,
298
299
} ,
299
300
} ) ;
300
301
await prisma . followedCourse . create ( {
301
302
data : {
302
303
courseHash : "neu.edu/202210/ARTF/1122" ,
303
304
userId : 2 ,
304
- notifCount : 0 ,
305
305
} ,
306
306
} ) ;
307
307
await prisma . followedCourse . create ( {
@@ -326,15 +326,15 @@ describe("Notifyer", () => {
326
326
} ,
327
327
} ) ;
328
328
329
- sendNotifications (
329
+ await sendNotifications (
330
330
notificationInfo ,
331
331
courseHashToUsers ,
332
332
sectionHashToUsers
333
333
) ;
334
334
expect ( mockSendNotificationText ) . toBeCalledTimes ( 5 ) ;
335
335
} ) ;
336
336
337
- it ( "does not send a notification if no users are subscribed to the updated course/section" , ( ) => {
337
+ it ( "does not send a notification if no users are subscribed to the updated course/section" , async ( ) => {
338
338
notificationInfo = {
339
339
updatedCourses : [
340
340
{
@@ -371,15 +371,16 @@ describe("Notifyer", () => {
371
371
{ id : 2 , phoneNumber : "+19879879876" } ,
372
372
] ,
373
373
} ;
374
- sendNotifications (
374
+ await sendNotifications (
375
375
notificationInfo ,
376
376
courseHashToUsers ,
377
377
sectionHashToUsers
378
378
) ;
379
379
expect ( mockSendNotificationText ) . toBeCalledTimes ( 0 ) ;
380
380
} ) ;
381
381
382
- it ( "sends a properly formatted message when a new section is added to a course" , ( ) => {
382
+ it ( "sends a properly formatted message when a new section is added to a course" , async ( ) => {
383
+ console . log ( "INSIDE TEST 2" ) ;
383
384
notificationInfo = {
384
385
updatedCourses : [
385
386
{
@@ -397,7 +398,7 @@ describe("Notifyer", () => {
397
398
"neu.edu/202210/ARTF/1122" : [ { id : 1 , phoneNumber : "+11231231234" } ] ,
398
399
} ;
399
400
sectionHashToUsers = { } ;
400
- sendNotifications (
401
+ await sendNotifications (
401
402
notificationInfo ,
402
403
courseHashToUsers ,
403
404
sectionHashToUsers
@@ -410,7 +411,8 @@ describe("Notifyer", () => {
410
411
) ;
411
412
} ) ;
412
413
413
- it ( "sends a properly formatted message when multiple sections are added to a course" , ( ) => {
414
+ it ( "sends a properly formatted message when multiple sections are added to a course" , async ( ) => {
415
+ console . log ( "INSIDE TEST 3" ) ;
414
416
notificationInfo = {
415
417
updatedCourses : [
416
418
{
@@ -428,7 +430,7 @@ describe("Notifyer", () => {
428
430
"neu.edu/202210/ARTF/1122" : [ { id : 1 , phoneNumber : "+11231231234" } ] ,
429
431
} ;
430
432
sectionHashToUsers = { } ;
431
- sendNotifications (
433
+ await sendNotifications (
432
434
notificationInfo ,
433
435
courseHashToUsers ,
434
436
sectionHashToUsers
@@ -441,7 +443,8 @@ describe("Notifyer", () => {
441
443
) ;
442
444
} ) ;
443
445
444
- it ( "sends a properly formatted message when seats open up in a section" , ( ) => {
446
+ it ( "sends a properly formatted message when seats open up in a section" , async ( ) => {
447
+ console . log ( "INSIDE TEST 4" ) ;
445
448
notificationInfo = {
446
449
updatedCourses : [ ] ,
447
450
updatedSections : [
@@ -462,7 +465,7 @@ describe("Notifyer", () => {
462
465
{ id : 1 , phoneNumber : "+11231231234" } ,
463
466
] ,
464
467
} ;
465
- sendNotifications (
468
+ await sendNotifications (
466
469
notificationInfo ,
467
470
courseHashToUsers ,
468
471
sectionHashToUsers
@@ -475,7 +478,8 @@ describe("Notifyer", () => {
475
478
) ;
476
479
} ) ;
477
480
478
- it ( "sends a properly formatted message when waitlist seats open up in a section" , ( ) => {
481
+ it ( "sends a properly formatted message when waitlist seats open up in a section" , async ( ) => {
482
+ console . log ( "INSIDE TEST 5" ) ;
479
483
notificationInfo = {
480
484
updatedCourses : [ ] ,
481
485
updatedSections : [
@@ -496,7 +500,7 @@ describe("Notifyer", () => {
496
500
{ id : 1 , phoneNumber : "+11231231234" } ,
497
501
] ,
498
502
} ;
499
- sendNotifications (
503
+ await sendNotifications (
500
504
notificationInfo ,
501
505
courseHashToUsers ,
502
506
sectionHashToUsers
0 commit comments