mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add test cases for sendNotificationImmediately
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user