syntaxai/tdd.md · main · src / c13_database.test.ts
// Sibling test for c13_database.ts (Layer 2, SQLite). End-to-end
// coverage is the live admin flow + git-native-proof e2e. This file
// pins the type/exports contract — the real shape of Verdict,
// SxDocumentDbRow, projects rows — so a reviewer sees what callers
// can depend on.
import { describe, test, expect } from "bun:test";
import {
saveRun,
upsertProject,
getProject,
listActiveProjects,
saveDocument,
loadDocument,
listDocuments,
deleteDocument,
} from "./c13_database.ts";
describe("c13_database — public surface", () => {
test("CRUD functions for projects are exported", () => {
expect(typeof upsertProject).toBe("function");
expect(typeof getProject).toBe("function");
expect(typeof listActiveProjects).toBe("function");
});
test("CRUD functions for sxdoc documents are exported", () => {
expect(typeof saveDocument).toBe("function");
expect(typeof loadDocument).toBe("function");
expect(typeof listDocuments).toBe("function");
expect(typeof deleteDocument).toBe("function");
});
test("saveRun is exported for the judge pipeline", () => {
expect(typeof saveRun).toBe("function");
});
});
describe("c13_database — listActiveProjects runtime smoke", () => {
test("returns an array (possibly empty)", () => {
const rows = listActiveProjects();
expect(Array.isArray(rows)).toBe(true);
});
});