From 661e8582a2c6a574ecf986f77e335d3e577267b0 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 12 May 2026 10:39:39 +0200 Subject: [PATCH] test(notification): add goto mock and tighten selector in NotificationDropdown spec Co-Authored-By: Claude Sonnet 4.6 --- .../lib/notification/NotificationDropdown.svelte.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts b/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts index d6d983df..be223bdf 100644 --- a/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts +++ b/frontend/src/lib/notification/NotificationDropdown.svelte.test.ts @@ -1,8 +1,11 @@ import { describe, it, expect, vi, afterEach } from 'vitest'; import { cleanup, render } from 'vitest-browser-svelte'; import { page } from 'vitest/browser'; +import { goto } from '$app/navigation'; import NotificationDropdown from './NotificationDropdown.svelte'; +vi.mock('$app/navigation', () => ({ goto: vi.fn() })); + afterEach(cleanup); const makeNotification = (overrides: Record = {}) => ({ @@ -164,9 +167,10 @@ describe('NotificationDropdown', () => { } }); - await page.getByRole('link').click(); + await page.getByRole('link', { name: /alle aktivitäten|view all/i }).click(); expect(onClose).toHaveBeenCalledOnce(); + expect(goto).toHaveBeenCalledWith('/aktivitaeten'); }); it('renders MENTION items with the mention verb text', async () => {