fix tests: add subject to email-verification assertion, add url + api-key mock to hooks test

This commit is contained in:
NeilClack
2026-07-08 15:36:11 -05:00
parent 3243f1d4a1
commit 2d0cf98ed3
2 changed files with 8 additions and 2 deletions
+7 -2
View File
@@ -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<string, unknown>,
resolve: vi.fn()
} as any;
@@ -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',