Files
WRNexusJS/packages/cli/test/runtime-connections.test.ts

14 lines
633 B
TypeScript

import { expect, test } from "bun:test";
import { productionConnections } from "../src/runtime-connections.ts";
test("deployment connections override build placeholders without accepting server settings", () => {
const db = { driver: "postgres", url: "postgres://runtime:secret@db/app" };
expect(productionConnections(JSON.stringify({ db, realtime: { scale: true } }))).toEqual({
db,
realtime: { scale: true },
});
expect(productionConnections("")).toEqual({});
for (const value of ["null", "[]", "invalid", '{"port":80}', '{"db":null}', '{"db":[]}'])
expect(() => productionConnections(value)).toThrow();
});