aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc/routers/invites.test.ts
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2025-07-12 12:33:23 +0000
committerMohamed Bassem <me@mbassem.com>2025-07-12 12:33:23 +0000
commit8e3013ba96532cab61eb6e5fae2ce30be5e94a57 (patch)
treeb101a0ac7e1218ea2562178e055044f315b0c245 /packages/trpc/routers/invites.test.ts
parent140311d7419fa2192e5149df8f589c3c3733a399 (diff)
downloadkarakeep-8e3013ba96532cab61eb6e5fae2ce30be5e94a57.tar.zst
refactor: Move db interactions into the trpc routes
Diffstat (limited to 'packages/trpc/routers/invites.test.ts')
-rw-r--r--packages/trpc/routers/invites.test.ts26
1 files changed, 26 insertions, 0 deletions
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<CustomTestContext>(defaultBeforeEach(false));
describe("Invites Router", () => {