diff --git a/test/services/NotificationServiceTests.test.ts b/test/services/NotificationServiceTests.test.ts index 4ef1953..a89dfa4 100644 --- a/test/services/NotificationServiceTests.test.ts +++ b/test/services/NotificationServiceTests.test.ts @@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, jest } from "@jest/globals"; import { NotificationService } from "../../src/services/NotificationService"; import { UnoptimizedInMemoryRepository } from "../../src/repositories/UnoptimizedInMemoryRepository"; import fs from "fs"; +import { IEta } from "../../src/entities/entities"; jest.mock("fs"); @@ -49,7 +50,23 @@ describe("NotificationService", () => { describe("scheduleNotification", () => { it("sends a notification to given shuttle/stop ID when changed", async () => { + // Arrange + const eta: IEta = { + shuttleId: "1", + stopId: "1", + secondsRemaining: 120, + }; + // Act + await notificationService.scheduleNotification({ + deviceId: "1", + shuttleId: eta.shuttleId, + stopId: eta.stopId, + }); + await repository.addOrUpdateEta(eta); + + // Assert + // ...that notification (fetch request) was sent }); it("clears the notification after delivering successfully", async () => {