mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
test: update toJson mock factories for doctor-report-prefs + healthkit
The v1.4.34.3 code-quality batch added a `toJson<T>()` helper in `src/lib/db.ts` to consolidate the seven Prisma JSON-cast sites. Two existing route tests mock the entire `@/lib/db` module via `vi.mock` — those mock factories now need to expose the new export so the route's import resolves to a real function under test. The mock implementation is the identity cast (`<T>(v: T) => v`), which matches what production does and keeps the test's JSON-payload assertions stable.
This commit is contained in:
1 parent
be7f4aa92b
commit
26f9880264
2 files changed
+2
No files matched your search
@@ -7,6 +7,7 @@ vi.mock("@/lib/db", () => ({
|
||||
update: vi.fn(),
|
||||
},
|
||||
},
|
||||
toJson: <T,>(v: T) => v,
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/auth/session", () => ({ getSession: vi.fn() }));
|
||||
|
||||
@@ -5,6 +5,7 @@ vi.mock("@/lib/db", () => ({
|
||||
prisma: {
|
||||
user: { findUnique: vi.fn(), update: vi.fn() },
|
||||
},
|
||||
toJson: <T,>(v: T) => v,
|
||||
}));
|
||||
|
||||
vi.mock("@/lib/auth/session", () => ({ getSession: vi.fn() }));
|
||||
|
||||
Reference in new issue
Block a user