test unsubscribeFromNotificationChanges method

This commit is contained in:
2025-03-31 20:34:45 -07:00
parent c6f846d109
commit fbc08838df

View File

@@ -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);