26 lines
736 B
TypeScript
26 lines
736 B
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { defineModuleRuntime } from "../src/index.js";
|
|
|
|
describe("defineModuleRuntime", () => {
|
|
it("defines a frozen server runtime without duplicating the static manifest", async () => {
|
|
const start = vi.fn();
|
|
const runtime = defineModuleRuntime({
|
|
id: "example",
|
|
start,
|
|
version: "0.1.0",
|
|
});
|
|
|
|
expect(runtime).toEqual({ id: "example", start, version: "0.1.0" });
|
|
expect(Object.isFrozen(runtime)).toBe(true);
|
|
});
|
|
|
|
it("rejects invalid runtime definitions", () => {
|
|
expect(() =>
|
|
defineModuleRuntime({
|
|
id: "Not Valid",
|
|
version: "0.1.0",
|
|
}),
|
|
).toThrow("Invalid Ekklesia module runtime definition.");
|
|
});
|
|
});
|