mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
add a second notification to schedule for the test
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user