15 lines
881 B
TypeScript
15 lines
881 B
TypeScript
import assert from "node:assert/strict";
|
|
import { readFile } from "node:fs/promises";
|
|
import test from "node:test";
|
|
|
|
test("migration 004 adds nullable quality identity without rewriting historical rows", async () => {
|
|
const sql = await readFile(new URL("../../migrations/004_ocr_quality_diagnostics.sql", import.meta.url), "utf8");
|
|
assert.match(sql, /quality_outcome text NULL/i);
|
|
assert.match(sql, /quality_warnings jsonb NOT NULL DEFAULT '\[\]'::jsonb/i);
|
|
assert.match(sql, /blocking_reasons jsonb NOT NULL DEFAULT '\[\]'::jsonb/i);
|
|
assert.match(sql, /primary_blocking_reason text NULL/i);
|
|
assert.match(sql, /quality_report_sha256 char\(64\) NULL/i);
|
|
assert.match(sql, /CHECK \(quality_outcome IN \('accepted', 'warning', 'blocked'\)\)/i);
|
|
assert.doesNotMatch(sql, /UPDATE\s+rag_document_pages/i);
|
|
assert.doesNotMatch(sql, /UPDATE\s+rag_source_versions/i);
|
|
});
|