From 711caa1d15f35f8134a88c53ac2b5dca6914307f Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Mon, 3 Feb 2025 21:52:01 -0800 Subject: [PATCH] add a second notification to schedule for the test --- test/services/NotificationServiceTests.test.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/test/services/NotificationServiceTests.test.ts b/test/services/NotificationServiceTests.test.ts index 53d7423..3cd2978 100644 --- a/test/services/NotificationServiceTests.test.ts +++ b/test/services/NotificationServiceTests.test.ts @@ -76,19 +76,26 @@ describe("NotificationService", () => { updateGlobalFetchMockJson({}); // Act - const notificationData = { + const notificationData1 = { deviceId: "1", shuttleId: eta.shuttleId, stopId: eta.stopId, } - await notificationService.scheduleNotification(notificationData); + const notificationData2 = { + ...notificationData1, + deviceId: "2", + } + await notificationService.scheduleNotification(notificationData1); + await notificationService.scheduleNotification(notificationData2); await repository.addOrUpdateEta(eta); // Assert expect(fetch as jest.Mock).toHaveBeenCalledTimes(1); - const isNotificationScheduled = notificationService.isNotificationScheduled(notificationData); + const isFirstNotificationScheduled = notificationService.isNotificationScheduled(notificationData1); + const isSecondNotificationScheduled = notificationService.isNotificationScheduled(notificationData2); // No longer scheduled after being sent - expect(isNotificationScheduled).toBe(false); + expect(isFirstNotificationScheduled).toBe(false); + expect(isSecondNotificationScheduled).toBe(false); }); it("leaves notification in array if delivery unsuccessful", async () => {