Files
NianAIGC/tests/database-readiness-contract.test.ts

26 lines
881 B
TypeScript

import { readFile } from "node:fs/promises";
import { describe, expect, it } from "vitest";
describe("PostgreSQL readiness contract", () => {
it("checks every runtime table and both atomic functions", async () => {
const source = await readFile(new URL("../lib/server/database.ts", import.meta.url), "utf8");
for (const table of [
"assets",
"generation_jobs",
"usage_events",
"projects",
"image_templates",
"platform_organizations",
"platform_users",
"platform_account_migrations",
"billing_price_rules",
"billing_wallets",
"billing_ledger"
]) {
expect(source).toContain(`('${table}',`);
}
expect(source).toContain("claim_generation_jobs(text,integer,integer)");
expect(source).toContain("billing_post_wallet_entry(text,text,text,text,text,bigint,text,text,text,jsonb)");
});
});