From b96b6c06fc1b9341eaf580d44c7226f33d1b3d99 Mon Sep 17 00:00:00 2001 From: Flea Flicker Date: Thu, 28 May 2026 15:59:41 +0000 Subject: [PATCH] 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 --- src/__tests__/portalSessionFromAuth.test.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/__tests__/portalSessionFromAuth.test.ts b/src/__tests__/portalSessionFromAuth.test.ts index 5079f0d..8448803 100644 --- a/src/__tests__/portalSessionFromAuth.test.ts +++ b/src/__tests__/portalSessionFromAuth.test.ts @@ -1,5 +1,6 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; import { Hono } from "hono"; +import { getAuth } from "../lib/auth.js"; const CLIENT_ID = "550e8400-e29b-41d4-a716-446655440001"; const CLIENT_EMAIL = "alice@example.com"; @@ -71,17 +72,15 @@ vi.mock("@groombook/db", () => { return makeChainable([]); }, }), - insert: () => ({ - into: (table: { _name: string }) => ({ - values: (vals: Record) => ({ - returning: () => { - if (table._name === "impersonationSessions") { - insertedSession = { id: "new-session-001", ...vals }; - return [insertedSession]; - } - return []; - }, - }), + insert: (table: { _name: string }) => ({ + values: (vals: Record) => ({ + returning: () => { + if (table._name === "impersonationSessions") { + insertedSession = { id: "new-session-001", ...vals }; + return [insertedSession]; + } + return []; + }, }), }), }),