mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
ensureDbCompatibility ran ALTER TABLE / CREATE TABLE IF NOT EXISTS on the login, register, token and session paths, mirroring columns every migration under prisma/migrations already creates. The entrypoint applies those migrations before the server listens and stops the boot when one fails, so the mirror never had work to do, and DDL on a request path needs the table's owner: a connection that may only read and write rows fails every login on it. Drop the module, its call sites and the mocks that stubbed it out.
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
/**
|
|
* The summary windows count from the request's clock in a session outside
|
|
* UTC too. The app pins its sessions to UTC; this runs the pool in another
|
|
* zone on purpose, so a bound that went through `timestamptz` (and so through
|
|
* the session zone) would be cut hours off (see
|
|
* `request-clock-windows.cases.ts`).
|
|
*/
|
|
import { describe, vi } from "vitest";
|
|
|
|
vi.mock("@/lib/db-session", async (importOriginal) => {
|
|
const actual = await importOriginal<typeof import("@/lib/db-session")>();
|
|
return { ...actual, TIME_ZONE_OPTION: "-c TimeZone=Pacific/Auckland" };
|
|
});
|
|
|
|
// The read path's fire-and-forget refresh would build the rollup tier behind
|
|
// the live case; the cases build it themselves when they mean to.
|
|
vi.mock("@/lib/rollups/measurement-rollups", async (importOriginal) => ({
|
|
...(await importOriginal<
|
|
typeof import("@/lib/rollups/measurement-rollups")
|
|
>()),
|
|
ensureUserRollupsFresh: async () => {},
|
|
}));
|
|
|
|
import { defineRequestClockCases } from "./request-clock-windows.cases";
|
|
|
|
describe("summary windows on the request's clock, outside UTC", () => {
|
|
defineRequestClockCases("Pacific/Auckland");
|
|
});
|