From 8e3013ba96532cab61eb6e5fae2ce30be5e94a57 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sat, 12 Jul 2025 12:33:23 +0000 Subject: refactor: Move db interactions into the trpc routes --- packages/trpc/routers/invites.test.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'packages/trpc/routers/invites.test.ts') diff --git a/packages/trpc/routers/invites.test.ts b/packages/trpc/routers/invites.test.ts index bb1209c4..f4f048df 100644 --- a/packages/trpc/routers/invites.test.ts +++ b/packages/trpc/routers/invites.test.ts @@ -6,6 +6,32 @@ import { invites, users } from "@karakeep/db/schema"; import type { CustomTestContext } from "../testUtils"; import { defaultBeforeEach, getApiCaller } from "../testUtils"; +// Mock server config with email settings +vi.mock("@karakeep/shared/config", async (original) => { + const mod = (await original()) as typeof import("@karakeep/shared/config"); + return { + ...mod, + default: { + ...mod.default, + email: { + smtp: { + host: "test-smtp.example.com", + port: 587, + secure: false, + user: "test@example.com", + password: "test-password", + from: "test@example.com", + }, + }, + }, + }; +}); + +// Mock email functions +vi.mock("../email", () => ({ + sendInviteEmail: vi.fn().mockResolvedValue(undefined), +})); + beforeEach(defaultBeforeEach(false)); describe("Invites Router", () => { -- cgit v1.2.3-70-g09d2