syntaxai/tdd.md · main · src / c14_git.test.ts

c14_git.test.ts 33 lines · 1064 bytes raw
// Sibling test for c14_git.ts (Layer 2, git binary I/O). End-to-end
// coverage in e2e/git-native-proof.spec.ts which writes a commit
// through the CMS and verifies the bare repo HEAD advanced. This
// sibling pins the export contract.

import { describe, test, expect } from "bun:test";
import {
  GIT_DIR,
  resolveRef,
  getFileBlobSha,
  readBlob,
  readBlobAtRef,
  lsTree,
  commitFile,
} from "./c14_git.ts";

describe("c14_git — export shape", () => {
  test("GIT_DIR is a non-empty path string", () => {
    expect(typeof GIT_DIR).toBe("string");
    expect(GIT_DIR.length).toBeGreaterThan(0);
  });
  test("read-side helpers are exported as async functions", () => {
    expect(typeof resolveRef).toBe("function");
    expect(typeof getFileBlobSha).toBe("function");
    expect(typeof readBlob).toBe("function");
    expect(typeof readBlobAtRef).toBe("function");
    expect(typeof lsTree).toBe("function");
  });
  test("write-side commitFile helper is exported as an async function", () => {
    expect(typeof commitFile).toBe("function");
  });
});