From c517d93e3a873febe27b689a7e91e54a2a8b1269 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Thu, 27 Mar 2025 10:02:13 -0700 Subject: [PATCH] add test cases and rename some methods --- src/repositories/NotificationRepository.ts | 4 +- .../NotificationRepositoryTests.test.ts | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 test/repositories/NotificationRepositoryTests.test.ts diff --git a/src/repositories/NotificationRepository.ts b/src/repositories/NotificationRepository.ts index e37256e..7f74914 100644 --- a/src/repositories/NotificationRepository.ts +++ b/src/repositories/NotificationRepository.ts @@ -23,11 +23,11 @@ export class NotificationRepository { } - public async addNotification(notification: ScheduledNotification) { + public async addOrUpdateNotification(notification: ScheduledNotification) { } - public async deleteNotification(lookupArguments: NotificationLookupArguments) { + public async deleteNotificationIfExists(lookupArguments: NotificationLookupArguments) { } } diff --git a/test/repositories/NotificationRepositoryTests.test.ts b/test/repositories/NotificationRepositoryTests.test.ts new file mode 100644 index 0000000..9bbe38c --- /dev/null +++ b/test/repositories/NotificationRepositoryTests.test.ts @@ -0,0 +1,43 @@ +import { describe, it } from "@jest/globals"; + +describe("NotificationRepository", () => { + describe("getAllNotificationsForShuttleAndStopId", () => { + it("gets notifications correctly", async () => { + + }); + + it("returns empty array if no notifications", async () => { + + }); + }); + + describe("getSecondsThresholdForNotificationIfExists", () => { + it("gets the seconds threshold if exists", async () => { + + }); + + it("returns null if there is no seconds threshold", async () => { + + }); + }); + + describe("addOrUpdateNotification", () => { + it("adds the notification", async () => { + + }); + + it("updates the seconds threshold if the notification exists already", async () => { + + }); + }); + + describe("deleteNotificationIfExists", () => { + it("deletes the notification", async () => { + + }); + + it("does nothing if there's no notification", async () => { + + }); + }); +});