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

c14_client_bundle.test.ts 27 lines · 1004 bytes raw
// Sibling test for c14_client_bundle.ts (Layer 2, calls Bun.build).
// The bundler is exercised by e2e/admin-block-editor.spec.ts which
// asserts /admin/assets/blockeditor.js returns 200 + ETag + 304-on-
// re-request. This sibling pins the contract.

import { describe, test, expect } from "bun:test";
import {
  bundleAdminClient,
  adminClientEntrypoint,
  _resetAdminClientCache,
} from "./c14_client_bundle.ts";

describe("c14_client_bundle — export shape", () => {
  test("bundleAdminClient is an async function", () => {
    expect(typeof bundleAdminClient).toBe("function");
  });
  test("adminClientEntrypoint() returns a non-empty string path", () => {
    expect(typeof adminClientEntrypoint).toBe("function");
    const path = adminClientEntrypoint();
    expect(typeof path).toBe("string");
    expect(path.length).toBeGreaterThan(0);
  });
  test("_resetAdminClientCache is a function (test-only cache hook)", () => {
    expect(typeof _resetAdminClientCache).toBe("function");
  });
});