diff --git a/frontend/vue-app/src/components/notification/__tests__/PushOptIn.spec.ts b/frontend/vue-app/src/components/notification/__tests__/PushOptIn.spec.ts index 5eef00e..7625879 100644 --- a/frontend/vue-app/src/components/notification/__tests__/PushOptIn.spec.ts +++ b/frontend/vue-app/src/components/notification/__tests__/PushOptIn.spec.ts @@ -6,7 +6,7 @@ const mockSubscribeToPush = vi.fn() const mockGetPushPermissionState = vi.fn() vi.mock('@/services/pushSubscription', () => ({ - subscribeToPush: () => mockSubscribeToPush(), + subscribeToPushWithResult: () => mockSubscribeToPush(), getPushPermissionState: () => mockGetPushPermissionState(), })) @@ -25,7 +25,7 @@ describe('PushOptIn', () => { describe('permission already granted on mount', () => { beforeEach(() => { setupNotificationMock('granted') - mockSubscribeToPush.mockResolvedValue(true) + mockSubscribeToPush.mockResolvedValue({ ok: true }) }) it('silently calls subscribeToPush without showing the banner', async () => { @@ -58,7 +58,7 @@ describe('PushOptIn', () => { }) it('calls subscribeToPush when Enable button is clicked', async () => { - mockSubscribeToPush.mockResolvedValue(true) + mockSubscribeToPush.mockResolvedValue({ ok: true }) const wrapper = mount(PushOptIn) await flushPromises() @@ -69,7 +69,7 @@ describe('PushOptIn', () => { }) it('hides banner after Enable is clicked and subscription succeeds', async () => { - mockSubscribeToPush.mockResolvedValue(true) + mockSubscribeToPush.mockResolvedValue({ ok: true }) const wrapper = mount(PushOptIn) await flushPromises() @@ -80,7 +80,7 @@ describe('PushOptIn', () => { }) it('does NOT post subscription to backend when subscribeToPush returns false', async () => { - mockSubscribeToPush.mockResolvedValue(false) + mockSubscribeToPush.mockResolvedValue({ ok: false, reason: 'permission_denied' }) const wrapper = mount(PushOptIn) await flushPromises()