From 2d0cf98ed3c2ea788605505abf43c3478cecc4a5 Mon Sep 17 00:00:00 2001 From: NeilClack Date: Wed, 8 Jul 2026 15:36:11 -0500 Subject: [PATCH] fix tests: add subject to email-verification assertion, add url + api-key mock to hooks test --- src/hooks.server.spec.ts | 9 +++++++-- src/lib/server/email-verification.spec.ts | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hooks.server.spec.ts b/src/hooks.server.spec.ts index 2b2d155..e79d7aa 100644 --- a/src/hooks.server.spec.ts +++ b/src/hooks.server.spec.ts @@ -24,11 +24,16 @@ vi.mock('$lib/auth', () => ({ } })); +vi.mock('$lib/server/api-key', () => ({ + validateApiKey: vi.fn() +})); + import { handle } from './hooks.server'; -function createMockEvent() { +function createMockEvent(path = '/dashboard') { return { - request: new Request('http://localhost/dashboard'), + request: new Request(`http://localhost${path}`), + url: new URL(`http://localhost${path}`), locals: {} as Record, resolve: vi.fn() } as any; diff --git a/src/lib/server/email-verification.spec.ts b/src/lib/server/email-verification.spec.ts index ab09509..3ff1f7c 100644 --- a/src/lib/server/email-verification.spec.ts +++ b/src/lib/server/email-verification.spec.ts @@ -29,6 +29,7 @@ describe('sendVerificationEmail', () => { expect(sendMail).toHaveBeenCalledWith({ to: 'jane@example.com', + subject: 'Verify your email address', templateId: 'email-verification-email', data: { target_email_address: 'jane@example.com',