KeiSeiKit-1.0/_ts_packages/packages/mcp-server/test/tool-registry.test.ts
Parfii-bot a4e667de10 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

31 lines
1 KiB
TypeScript

import { describe, it, expect } from "vitest";
import { buildRegistry, lookupTool, RUST_PRIMITIVE_TOOLS } from "../src/tool-registry.js";
import { RustBridge } from "../src/rust-bridge.js";
import { ToolNotFoundError } from "../src/errors.js";
describe("tool registry", () => {
const bridge = new RustBridge({ binDir: "/tmp/stub" });
const registry = buildRegistry(bridge);
it("registers one tool per Rust primitive", () => {
for (const t of RUST_PRIMITIVE_TOOLS) {
expect(registry.has(t.binary)).toBe(true);
}
});
it("registers the kei meta-tool", () => {
const t = lookupTool(registry, "kei");
expect(t.name).toBe("kei");
expect(t.description).toContain("Meta-tool");
});
it("lookupTool throws ToolNotFoundError for unknown names", () => {
expect(() => lookupTool(registry, "nonexistent-tool")).toThrow(ToolNotFoundError);
});
it("tool description is non-empty for each primitive", () => {
for (const t of RUST_PRIMITIVE_TOOLS) {
expect(t.desc.length).toBeGreaterThan(10);
}
});
});