add a second notification to schedule for the test

This commit is contained in:
2025-02-03 21:52:01 -08:00
parent 90e5fa200e
commit 711caa1d15

View File

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