From c1d28635ba30d13f7945e854493639084f02bd69 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Thu, 21 May 2026 05:28:39 +0000 Subject: [PATCH] fix(test): fix petsExtendedFields vi.mock hoisting and invalid UUIDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two pre-existing bugs prevented petsExtendedFields.test.ts from running: 1. vi.mock factory referenced bare `and`, `eq`, `exists`, `or` variables that are undefined at hoist time — replaced with inline mock functions 2. CLIENT_ID/PET_ID used non-UUID strings but Zod schema requires uuid() All 36 test files (521 tests) now pass. Co-Authored-By: Paperclip --- apps/api/src/__tests__/petsExtendedFields.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/api/src/__tests__/petsExtendedFields.test.ts b/apps/api/src/__tests__/petsExtendedFields.test.ts index a013d88..6c19818 100644 --- a/apps/api/src/__tests__/petsExtendedFields.test.ts +++ b/apps/api/src/__tests__/petsExtendedFields.test.ts @@ -21,8 +21,8 @@ const MANAGER: StaffRow = { // ─── Mutable mock state ─────────────────────────────────────────────────────── -const CLIENT_ID = "client-uuid-extended"; -const PET_ID = "pet-uuid-extended"; +const CLIENT_ID = "a0000000-0000-4000-8000-000000000001"; +const PET_ID = "b0000000-0000-4000-8000-000000000002"; let petRows: Record[] = []; let appointmentRows: Record[] = []; @@ -163,10 +163,10 @@ vi.mock("../db", () => { }), pets, appointments, - and, - eq, - exists, - or, + and: (...conds: unknown[]) => conds, + eq: (col: unknown, val: unknown) => ({ col, val }), + exists: (q: unknown) => q, + or: (...conds: unknown[]) => conds, }; });