diff --git a/test/repositories/NotificationRepositorySharedTests.test.ts b/test/repositories/NotificationRepositorySharedTests.test.ts index 6c7587f..d8df44e 100644 --- a/test/repositories/NotificationRepositorySharedTests.test.ts +++ b/test/repositories/NotificationRepositorySharedTests.test.ts @@ -183,6 +183,21 @@ describe.each(repositoryImplementations)('$name', (holder) => { }); }); + describe("unsubscribeFromNotificationChanges", () => { + it("stops calling subscribers when unsubscribed", async () => { + const mockCallback = jest.fn(); + repo.subscribeToNotificationChanges(mockCallback); + + await repo.addOrUpdateNotification(notification); + + repo.unsubscribeFromNotificationChanges(mockCallback); + + await repo.deleteNotificationIfExists(notification); + + expect(mockCallback).toHaveBeenCalledTimes(1); + }); + }); + describe("isNotificationScheduled", () => { it("returns true if the notification is in the repo", async () => { await repo.addOrUpdateNotification(notification);