fix: add missing getAuth import and fix db.insert() mock chain

Fixes two bugs found in QA review:
- ReferenceError: getAuth not defined in beforeEach - add import
- TypeError: wrong mock chain insert().into().values() vs insert().values()

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Flea Flicker
2026-05-28 15:59:41 +00:00
parent fa67b75b76
commit b96b6c06fc
+10 -11
View File
@@ -1,5 +1,6 @@
import { describe, it, expect, vi, beforeEach } from "vitest"; import { describe, it, expect, vi, beforeEach } from "vitest";
import { Hono } from "hono"; import { Hono } from "hono";
import { getAuth } from "../lib/auth.js";
const CLIENT_ID = "550e8400-e29b-41d4-a716-446655440001"; const CLIENT_ID = "550e8400-e29b-41d4-a716-446655440001";
const CLIENT_EMAIL = "alice@example.com"; const CLIENT_EMAIL = "alice@example.com";
@@ -71,17 +72,15 @@ vi.mock("@groombook/db", () => {
return makeChainable([]); return makeChainable([]);
}, },
}), }),
insert: () => ({ insert: (table: { _name: string }) => ({
into: (table: { _name: string }) => ({ values: (vals: Record<string, unknown>) => ({
values: (vals: Record<string, unknown>) => ({ returning: () => {
returning: () => { if (table._name === "impersonationSessions") {
if (table._name === "impersonationSessions") { insertedSession = { id: "new-session-001", ...vals };
insertedSession = { id: "new-session-001", ...vals }; return [insertedSession];
return [insertedSession]; }
} return [];
return []; },
},
}),
}), }),
}), }),
}), }),