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 () => {