feat: expose core identity transport
CI / verify (pull_request) Successful in 27s
CI / infrastructure-smoke (pull_request) Successful in 19s
CI / migration-smoke (pull_request) Successful in 26s

This commit is contained in:
ekklesia
2026-07-21 19:15:14 -05:00
parent 82fe338a8d
commit 91d8f5946f
33 changed files with 2672 additions and 224 deletions
+19 -2
View File
@@ -37,7 +37,7 @@ describe("Core identity Drizzle database composition", () => {
it("explicitly constructs the pool only when called, with the identity schema attached", () => {
poolConstructor.mockImplementation(function fakePool() {
return { end: async () => undefined };
return { end: async () => undefined, on: vi.fn() };
});
const handle = createIdentityDrizzleDatabase(
@@ -52,7 +52,7 @@ describe("Core identity Drizzle database composition", () => {
it("passes the connection timeout through to the pool configuration", () => {
poolConstructor.mockImplementation(function fakePool() {
return { end: async () => undefined };
return { end: async () => undefined, on: vi.fn() };
});
poolConstructor.mockClear();
@@ -64,4 +64,21 @@ describe("Core identity Drizzle database composition", () => {
expect.objectContaining({ connectionTimeoutMillis: 5_000 }),
);
});
it("registers a pool-level error listener so an idle client failure never becomes an uncaught exception", () => {
const on = vi.fn();
poolConstructor.mockImplementation(function fakePool() {
return { end: async () => undefined, on };
});
createIdentityDrizzleDatabase("postgresql://example.test/ekklesia");
expect(on).toHaveBeenCalledWith("error", expect.any(Function));
const handler = on.mock.calls.find((call) => call[0] === "error")?.[1] as
| ((error: unknown) => void)
| undefined;
expect(() =>
handler?.(new Error("terminating connection due to administrator command")),
).not.toThrow();
});
});