import { describe, expect, it, vi } from "vitest"; import { IMPORT_SAFETY_TEST_TIMEOUT_MS } from "./support/import-safety.js"; 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()), 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(); }, IMPORT_SAFETY_TEST_TIMEOUT_MS, ); });