diff --git a/test/services/NotificationServiceTests.test.ts b/test/services/NotificationServiceTests.test.ts index 0d25b1b..29982b3 100644 --- a/test/services/NotificationServiceTests.test.ts +++ b/test/services/NotificationServiceTests.test.ts @@ -1,4 +1,4 @@ -import { beforeEach, describe, it } from "@jest/globals"; +import { beforeEach, describe, expect, it } from "@jest/globals"; import { NotificationService } from "../../src/services/NotificationService"; import { UnoptimizedInMemoryRepository } from "../../src/repositories/UnoptimizedInMemoryRepository"; @@ -13,10 +13,17 @@ describe("NotificationService", () => { describe("reloadAPNsTokenIfTimePassed", () => { it("reloads the token if token hasn't been generated yet", async () => { + notificationService.reloadAPNsTokenIfTimePassed(); + expect(notificationService.lastRefreshedTimeMs).toBeDefined(); }); it("doesn't reload the token if last refreshed time is recent", async () => { + notificationService.reloadAPNsTokenIfTimePassed(); + const lastRefreshedTimeMs = notificationService.lastRefreshedTimeMs; + notificationService.reloadAPNsTokenIfTimePassed(); + // Expect no change to have occurred + expect(lastRefreshedTimeMs).toEqual(notificationService.lastRefreshedTimeMs); }); })