From 092528f9cdc8f40500323c66bbc659ea0d9b334d Mon Sep 17 00:00:00 2001 From: Salihu Date: Wed, 15 Oct 2025 21:50:53 +0100 Subject: [PATCH] add notification test --- server/models/Notification.test.ts | 32 +++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/server/models/Notification.test.ts b/server/models/Notification.test.ts index 61a5b31def..1d1475f81d 100644 --- a/server/models/Notification.test.ts +++ b/server/models/Notification.test.ts @@ -49,7 +49,7 @@ describe("Notification", () => { }); }); - describe("should return mention reference", () => { + describe.only("should return mention reference", () => { it("mentioned in document", async () => { const document = await buildDocument(); const notification = await buildNotification({ @@ -81,6 +81,36 @@ describe("Notification", () => { expect(references?.length).toBe(1); expect(references![0]).toBe(expectedReference); }); + + it("group mentioned in document", async () => { + const document = await buildDocument(); + const notification = await buildNotification({ + event: NotificationEventType.GroupMentionedInDocument, + documentId: document.id, + }); + + const references = await Notification.emailReferences(notification); + const expectedReference = Notification.emailMessageId( + `${document.id}-group-mentions` + ); + expect(references?.length).toBe(1); + expect(references![0]).toBe(expectedReference); + }); + + it("group mentioned in comment", async () => { + const document = await buildDocument(); + const notification = await buildNotification({ + event: NotificationEventType.GroupMentionedInComment, + documentId: document.id, + }); + + const references = await Notification.emailReferences(notification); + const expectedReference = Notification.emailMessageId( + `${document.id}-group-mentions` + ); + expect(references?.length).toBe(1); + expect(references![0]).toBe(expectedReference); + }); }); describe("should return comment reference", () => {