Files
Ekklesia/core/tests/module-http-import.test.ts
T
ekklesiaandClaude Sonnet 5 e296e083ec feat: define module HTTP routes
Phase 5B, pass 1: framework-neutral module HTTP route contracts and runtime
registration. Adds @ekklesia/contracts' module-http.ts (methods, canonical
path grammar, route definition/context/handler types, and validation)
and Core's module runtime staging/publication of a module's declared
routes alongside its capabilities, gated on the module's own manifest
permissions. Routes are collected into StartedModuleRuntime as an
immutable snapshot but are not yet mounted into apps/api; that is pass 2.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-07-24 18:36:23 -05:00

27 lines
779 B
TypeScript

import { describe, expect, it, vi } from "vitest";
const readdir = vi.fn();
const readFile = vi.fn();
const realpath = vi.fn();
const stat = vi.fn();
vi.mock("node:fs/promises", async (importOriginal) => ({
...(await importOriginal<typeof import("node:fs/promises")>()),
readdir,
readFile,
realpath,
stat,
}));
describe("module HTTP contract and runtime import safety", () => {
it("performs no filesystem I/O merely by importing the module runtime or the module-http contract", async () => {
await import("../src/modules/index.js");
await import("@ekklesia/contracts");
expect(readdir).not.toHaveBeenCalled();
expect(readFile).not.toHaveBeenCalled();
expect(realpath).not.toHaveBeenCalled();
expect(stat).not.toHaveBeenCalled();
});
});