Files
reverse-engineering-anything/tests/evaluation/toolRegistrationGuard.test.ts
T
morluto 5d3e1dc9cd refactor(mcp): bind analysis settings and session-derived comparison tools through the shared binding table (#11511)
* refactor(mcp): bind analysis settings tools through the shared binding table and count bespoke registrations

* refactor(mcp): bind inspect_analysis_view through the shared binding table (#11514)

* refactor(javascript): bind JavaScript source analysis in composition (#11467)

* refactor(mcp): bind inspect_analysis_view through the shared binding table

* ci(guards): count typed tool registrations and name each registration owner with its reason

* refactor(mcp): bind session-derived comparison tools through a derived binding kind on the shared table (#11547)
2026-11-16 06:18:49 +08:00

34 lines
1.1 KiB
TypeScript

import { expect, it } from "vitest";
import {
TOOL_REGISTRATION_OWNERS,
toolRegistrationCount,
} from "../../scripts/verify/tool-registration-guard.mjs";
it.each([
["a plain registration", "server.registerTool(contract.name, options, run);"],
[
"a typed registration",
"server.registerTool<typeof output, typeof input>(name, options, run);",
],
["a spaced typed registration", "super.registerTool <Out, In> (name, o, r);"],
[
"a multi-line registration",
"server\n .registerTool(\n contract.name,\n options,\n run,\n );",
],
])("counts %s", (_name, content) => {
expect(toolRegistrationCount(content)).toBe(1);
});
it.each([
["a declaration", "override registerTool<Out, In>(name: string) {}"],
["a mention in text", 'const name = "registerTool";'],
["another method", "server.registerTools(bindings);"],
])("ignores %s", (_name, content) => {
expect(toolRegistrationCount(content)).toBe(0);
});
it("states why each owner may register tools", () => {
for (const reason of TOOL_REGISTRATION_OWNERS.values())
expect(reason).not.toBe("");
});