From 63108f4eb5a6ca1815fdaae4c21ac26589b4f0ed Mon Sep 17 00:00:00 2001 From: nitrix Date: Fri, 6 Mar 2026 22:53:36 +0100 Subject: [PATCH] Fix TypeScript type errors in frontend test files - Add missing timezone field to CreateEventResponse mock - Fix createTestRouter signature to accept optional token parameter - Add non-null assertion for dateField element access Co-Authored-By: Claude Opus 4.6 --- frontend/src/views/__tests__/EventCreateView.spec.ts | 1 + frontend/src/views/__tests__/EventDetailView.spec.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/__tests__/EventCreateView.spec.ts b/frontend/src/views/__tests__/EventCreateView.spec.ts index 1807d08..447de76 100644 --- a/frontend/src/views/__tests__/EventCreateView.spec.ts +++ b/frontend/src/views/__tests__/EventCreateView.spec.ts @@ -173,6 +173,7 @@ describe('EventCreateView', () => { organizerToken: 'org-456', title: 'Birthday Party', dateTime: '2026-12-25T18:00:00+01:00', + timezone: 'Europe/Berlin', expiryDate: '2026-12-24', }, error: undefined, diff --git a/frontend/src/views/__tests__/EventDetailView.spec.ts b/frontend/src/views/__tests__/EventDetailView.spec.ts index 634f94d..fddc8dd 100644 --- a/frontend/src/views/__tests__/EventDetailView.spec.ts +++ b/frontend/src/views/__tests__/EventDetailView.spec.ts @@ -10,7 +10,7 @@ vi.mock('@/api/client', () => ({ }, })) -function createTestRouter() { +function createTestRouter(_token?: string) { return createRouter({ history: createMemoryHistory(), routes: [ @@ -84,7 +84,7 @@ describe('EventDetailView', () => { const wrapper = await mountWithToken() await flushPromises() - const dateField = wrapper.findAll('.detail__value')[0] + const dateField = wrapper.findAll('.detail__value')[0]! expect(dateField.text()).toContain('(Europe/Berlin)') // The formatted date part is locale-dependent but should contain the year expect(dateField.text()).toContain('2026')