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]>
27 lines
779 B
TypeScript
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();
|
|
});
|
|
});
|