fix tests: add subject to email-verification assertion, add url + api-key mock to hooks test
This commit is contained in:
@@ -24,11 +24,16 @@ vi.mock('$lib/auth', () => ({
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
vi.mock('$lib/server/api-key', () => ({
|
||||||
|
validateApiKey: vi.fn()
|
||||||
|
}));
|
||||||
|
|
||||||
import { handle } from './hooks.server';
|
import { handle } from './hooks.server';
|
||||||
|
|
||||||
function createMockEvent() {
|
function createMockEvent(path = '/dashboard') {
|
||||||
return {
|
return {
|
||||||
request: new Request('http://localhost/dashboard'),
|
request: new Request(`http://localhost${path}`),
|
||||||
|
url: new URL(`http://localhost${path}`),
|
||||||
locals: {} as Record<string, unknown>,
|
locals: {} as Record<string, unknown>,
|
||||||
resolve: vi.fn()
|
resolve: vi.fn()
|
||||||
} as any;
|
} as any;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ describe('sendVerificationEmail', () => {
|
|||||||
|
|
||||||
expect(sendMail).toHaveBeenCalledWith({
|
expect(sendMail).toHaveBeenCalledWith({
|
||||||
to: 'jane@example.com',
|
to: 'jane@example.com',
|
||||||
|
subject: 'Verify your email address',
|
||||||
templateId: 'email-verification-email',
|
templateId: 'email-verification-email',
|
||||||
data: {
|
data: {
|
||||||
target_email_address: 'jane@example.com',
|
target_email_address: 'jane@example.com',
|
||||||
|
|||||||
Reference in New Issue
Block a user