Files
Jyotisha/frontend/tests/database-postgres-fixture-contract.test.ts
T
jesse-uxandClaude Code 018b2b4883
Independent Staging Quality Gate / validate (push) Successful in 11m8s
Independent Staging Quality Gate / publish (push) Successful in 3m52s
fix(test): stream large report snapshot SQL
Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-23 18:51:08 +08:00

28 lines
929 B
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { startPostgresFixture } from "./helpers/postgres-fixture.ts";
test("stdin PostgreSQL scripts carry large SQL and preserve transaction-local settings", () => {
const fixture = startPostgresFixture();
try {
const payload = "x".repeat(131_073);
const script = `
select set_config('app.test_large_script', 'stdin-helper', true);
select current_setting('app.test_large_script');
select length($$${payload}$$);
`;
assert.equal(Buffer.byteLength(script, "utf8") > 131_072, true);
assert.equal(
fixture.psqlScriptAs("postgres", "postgres-test-password", script),
"stdin-helper\nstdin-helper\n131073",
);
assert.equal(
fixture.psqlScriptAs("postgres", "postgres-test-password", "select repeat('x', 1048577);"),
"x".repeat(1_048_577),
);
} finally {
fixture.stop();
}
});