Files
OmniRoute/tests/unit/cli-tools-schema.test.ts
Hernan Javier Ardila Sanchez fd26e601a2 fix(dashboard): use lightweight ping endpoint for MaintenanceBanner (fixes #3040) (#3043)
Integrated into release/v3.8.8. Applied review fixes: moved the SELECT 1 into a pingDb() db helper (no raw SQL in route, Hard Rule #5) + the 503 catch no longer leaks err.message (Hard Rule #12). Thanks @herjarsa!
2026-06-01 14:30:17 -03:00

56 lines
2.6 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
test("CLI_TOOLS registry contains all expected tools (plan 14 — 29 total)", async () => {
const { CLI_TOOLS } = await import("../../src/shared/constants/cliTools.ts");
// windsurf and amp removed per plan 14 D17 (MITM backlog plan 11)
// 10 new entries added: roo, jcode, deepseek-tui, smelt, pi, aider, forge,
// gemini-cli, cursor-cli, goose, interpreter, warp, agent-deck (+ hermes-agent already existed)
const expected = [
"claude", "codex", "droid", "openclaw", "cursor", "cline", "kilo", "continue",
"antigravity", "copilot", "opencode", "hermes", "hermes-agent", "kiro", "qwen", "custom",
"aider", "forge", "gemini-cli", "cursor-cli", "roo", "jcode", "deepseek-tui", "smelt", "pi",
"goose", "interpreter", "warp", "agent-deck",
];
for (const id of expected) {
assert.ok(id in CLI_TOOLS, `Missing tool: ${id}`);
}
assert.equal(Object.keys(CLI_TOOLS).length, expected.length);
// Confirm removed entries are gone
assert.equal((CLI_TOOLS as Record<string, unknown>)["windsurf"], undefined);
assert.equal((CLI_TOOLS as Record<string, unknown>)["amp"], undefined);
});
test("Every tool has required fields: id, name, description, configType", async () => {
const { CLI_TOOLS } = await import("../../src/shared/constants/cliTools.ts");
for (const [key, tool] of Object.entries(CLI_TOOLS)) {
assert.equal(typeof tool.id, "string", `${key}.id must be string`);
assert.equal(tool.id, key, `${key}.id must match its registry key`);
assert.equal(typeof tool.name, "string", `${key}.name must be string`);
assert.ok(tool.name.length > 0, `${key}.name must be non-empty`);
assert.equal(typeof tool.description, "string", `${key}.description must be string`);
assert.equal(typeof tool.configType, "string", `${key}.configType must be string`);
}
});
test("listCliTools returns all tools as an array", async () => {
const { listCliTools, CLI_TOOLS } = await import("../../src/shared/constants/cliTools.ts");
const tools = listCliTools();
assert.ok(Array.isArray(tools));
assert.equal(tools.length, Object.keys(CLI_TOOLS).length);
for (const tool of tools) {
assert.equal(typeof tool.id, "string");
}
});
test("getCliTool returns correct tool by id", async () => {
const { getCliTool } = await import("../../src/shared/constants/cliTools.ts");
const claude = getCliTool("claude");
assert.ok(claude);
assert.equal(claude.id, "claude");
assert.equal(claude.name, "Claude Code");
const missing = getCliTool("nonexistent");
assert.equal(missing, undefined);
});