From b79dcb8df14fa456b677d51354b1083f08fb234a Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 10 May 2026 06:23:22 +0200 Subject: [PATCH] test(notification): expand NotificationDropdown coverage Adds MENTION verb text, REPLY verb/glyph, multiple notifications rendering. 3 new tests covering ~5 branches. Refs #496. Co-Authored-By: Claude Sonnet 4.6 --- .../NotificationDropdown.svelte.test.ts | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts b/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts index 0c78212f..d6d983df 100644 --- a/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts +++ b/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts @@ -168,4 +168,49 @@ describe('NotificationDropdown', () => { expect(onClose).toHaveBeenCalledOnce(); }); + + it('renders MENTION items with the mention verb text', async () => { + render(NotificationDropdown, { + props: { + notifications: [makeNotification({ id: 'm1', type: 'MENTION', actorName: 'Anna' })], + onMarkRead: () => {}, + onMarkAllRead: () => {}, + onClose: () => {} + } + }); + + expect(document.body.textContent).toMatch(/erwähnt|mention/i); + }); + + it('renders REPLY items with the reply glyph', async () => { + render(NotificationDropdown, { + props: { + notifications: [makeNotification({ id: 'r1', type: 'REPLY', actorName: 'Bert' })], + onMarkRead: () => {}, + onMarkAllRead: () => {}, + onClose: () => {} + } + }); + + // Reply uses the curved-arrow glyph + expect(document.body.textContent).toMatch(/↩|reply|geantwortet/i); + }); + + it('renders multiple notifications in order', async () => { + render(NotificationDropdown, { + props: { + notifications: [ + makeNotification({ id: 'n1', actorName: 'First' }), + makeNotification({ id: 'n2', actorName: 'Second' }) + ], + onMarkRead: () => {}, + onMarkAllRead: () => {}, + onClose: () => {} + } + }); + + const items = document.querySelectorAll('button[type="button"]'); + // At least 2 items + mark-all button + expect(items.length).toBeGreaterThanOrEqual(2); + }); });