39 lines
1.6 KiB
TypeScript
39 lines
1.6 KiB
TypeScript
/**
|
|
* extensibility.test.ts — the registry extensibility claim (task 14).
|
|
*
|
|
* Proves a NEW check added as a file in `src/checks/` plus one `registerCheck()`
|
|
* entry yields a working `/pygienium-<name>` command with ZERO `index.ts`
|
|
* command-wiring changes. The witness is `src/checks/noop.ts`: importing it
|
|
* self-registers the `noop` check, after which the generic command-binding path
|
|
* (`registerPygieniumCommands`, the exact function `index.ts` calls) exposes
|
|
* `/pygienium-noop` and `/pygienium-help` lists it.
|
|
*/
|
|
import { describe, expect, it } from "bun:test";
|
|
import "../src/checks/noop.js";
|
|
import { getCheck, getAllChecks } from "../src/checks/registry.js";
|
|
import { registerPygieniumCommands } from "../src/commands.js";
|
|
import { buildPygieniumHelpLines } from "../src/help.js";
|
|
|
|
describe("registry extensibility (task 14)", () => {
|
|
it("the noop check file self-registers (no index.ts edits)", () => {
|
|
// Importing checks/noop.ts ran its top-level registerCheck(noopCheck).
|
|
expect(getCheck("noop")).toBeDefined();
|
|
expect(getAllChecks().some((c) => c.name === "noop")).toBe(true);
|
|
});
|
|
|
|
it("registerPygieniumCommands exposes /pygienium-noop (zero wiring)", () => {
|
|
const names: string[] = [];
|
|
registerPygieniumCommands((name) => names.push(name));
|
|
expect(names).toContain("pygienium-noop");
|
|
// And the operator commands are still wired.
|
|
expect(names).toContain("pygienium-help");
|
|
expect(names).toContain("pygienium-all");
|
|
});
|
|
|
|
it("/pygienium-help lists the noop check", () => {
|
|
const text = buildPygieniumHelpLines().join("\n");
|
|
expect(text).toContain("/pygienium-noop");
|
|
expect(text).toContain(getCheck("noop")!.description);
|
|
});
|
|
});
|