/** * Dep-graph integration: the orchestration module is reachable through its * declared subpath export and ships with its sibling `.md` docs. */ import { existsSync, readFileSync } from "node:fs"; import { resolve } from "node:path"; import { describe, expect, it } from "@suaveplan/testing/runner"; const PKG_ROOT = resolve(__dirname, ".."); describe("orchestration dep-graph", () => { it("orchestration subpath export is reachable", { timeout: 5000, }, async () => { const mod = await import("../src/orchestration/index.js"); expect(typeof mod.createRootKeys).toBe("function"); expect(typeof mod.createServerKeys).toBe("function"); expect(typeof mod.rollServerKeys).toBe("function"); expect(typeof mod.openVault).toBe("function"); expect(typeof mod.packVault).toBe("function"); expect(typeof mod.viewPublicKeys).toBe("function"); expect(typeof mod.saveVaultToStorage).toBe("function"); expect(typeof mod.savePublicKeysToStorage).toBe("function"); expect(typeof mod.getDataFromStorage).toBe("function"); }); it("orchestration subpath is declared in package.json exports", { timeout: 5000, }, () => { const pkg = JSON.parse( readFileSync(resolve(PKG_ROOT, "package.json"), "utf8") ) as { exports: Record }; expect(pkg.exports["./orchestration/orchestration"]).toBeDefined(); }); it("orchestration.ts has a sibling .md", { timeout: 5000 }, () => { const mdPath = resolve(PKG_ROOT, "src/orchestration/orchestration.md"); expect(existsSync(mdPath)).toBe(true); const body = readFileSync(mdPath, "utf8"); // ≥200 words excluding code blocks — quick floor check. const prose = body.replace(/```[\s\S]*?```/g, ""); const words = prose.split(/\s+/).filter(Boolean); expect(words.length).toBeGreaterThanOrEqual(200); }); it("internals.ts has a sibling .md", { timeout: 5000 }, () => { const mdPath = resolve(PKG_ROOT, "src/orchestration/internals.md"); expect(existsSync(mdPath)).toBe(true); }); });