24 lines
1.4 KiB
TypeScript
24 lines
1.4 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
|
|
const migration = readFileSync(
|
|
new URL("../supabase/migrations/20260807010000_retire_legacy_rectification_runtime.sql", import.meta.url),
|
|
"utf8",
|
|
);
|
|
|
|
test("legacy rectification retirement closes executable work without deleting history", () => {
|
|
assert.match(migration, /birth_time_rectification_question_handoffs[\s\S]*state = 'consumed'/);
|
|
assert.match(migration, /birth_time_rectification_v4_handoffs[\s\S]*state = 'consumed'/);
|
|
assert.match(migration, /birth_time_rectification_v4_jobs[\s\S]*status = 'stale'[\s\S]*where status in \('pending', 'processing'\)/);
|
|
assert.match(migration, /birth_time_rectification_v4_cases[\s\S]*status = 'abandoned'[\s\S]*accepted_range_start is null/);
|
|
assert.match(migration, /birth_time_rectification_cases[\s\S]*status = 'abandoned'[\s\S]*status not in \('confirmed', 'completed', 'abandoned'\)/);
|
|
assert.doesNotMatch(migration, /\bdelete\s+from\b|\bdrop\s+(?:table|function)\b/i);
|
|
});
|
|
|
|
test("legacy rectification retirement leaves durable account truth and ledgers untouched", () => {
|
|
assert.doesNotMatch(migration, /public\.profiles|active_birth_time|birth_time_status/);
|
|
assert.doesNotMatch(migration, /birth_time_rectification_billing|birth_time_rectification_action_receipts/);
|
|
assert.doesNotMatch(migration, /credit_transactions|consultation_requests|admin_audit_logs|auth\.users/);
|
|
});
|