mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
test unsubscribeFromNotificationChanges method
This commit is contained in:
@@ -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", () => {
|
describe("isNotificationScheduled", () => {
|
||||||
it("returns true if the notification is in the repo", async () => {
|
it("returns true if the notification is in the repo", async () => {
|
||||||
await repo.addOrUpdateNotification(notification);
|
await repo.addOrUpdateNotification(notification);
|
||||||
|
|||||||
Reference in New Issue
Block a user