From e433662f19c64b0083cdf5b6580e77c96dcc88f5 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Mon, 24 Mar 2025 10:09:37 -0700 Subject: [PATCH] add test cases for sendNotificationImmediately --- .../AppleNotificationSenderTests.test.ts | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/test/notifications/senders/AppleNotificationSenderTests.test.ts b/test/notifications/senders/AppleNotificationSenderTests.test.ts index 919f535..9804e20 100644 --- a/test/notifications/senders/AppleNotificationSenderTests.test.ts +++ b/test/notifications/senders/AppleNotificationSenderTests.test.ts @@ -1,7 +1,10 @@ import { beforeEach, describe, expect, it, jest } from "@jest/globals"; import http2 from "http2"; import { EventEmitter } from "node:events"; -import { AppleNotificationSender } from "../../../src/notifications/senders/AppleNotificationSender"; +import { + AppleNotificationSender, + NotificationAlertArguments +} from "../../../src/notifications/senders/AppleNotificationSender"; import { ETANotificationScheduler } from "../../../src/notifications/schedulers/ETANotificationScheduler"; jest.mock("http2"); @@ -89,6 +92,26 @@ describe("AppleNotificationSender", () => { }); describe("sendNotificationImmediately", () => { + it('makes the connection to the http server if the notification should be sent', async () => { + }); + + it('throws an error if the bundle ID is not set correctly', async () => { + + }); + + it('does not send notification if shouldActuallySendNotifications is false', async () => { + notificationSender = new AppleNotificationSender(false); + + const notificationArguments: NotificationAlertArguments = { + title: 'Test notification', + body: 'This notification should not send', + } + + const result = await notificationSender.sendNotificationImmediately('1', notificationArguments); + + expect(http2.connect).not.toHaveBeenCalled(); + expect(result).toBe(true); + }); }); });