Files
OmniRoute/tests/unit/cli-tools-schema.test.ts
diegosouzapw 193bf1a766 feat(cli-tools): extend catalog with category/vendor/acpSpawnable/baseUrlSupport + new entries (plan 14 F1)
- Add CliCatalogEntrySchema (Zod) + CliCatalogEntry type + CliCatalogSchema in src/shared/schemas/cliCatalog.ts
- Add ToolBatchStatus + ToolBatchStatusMap interfaces in src/shared/types/cliBatchStatus.ts
- Re-export cliBatchStatus from src/shared/types/index.ts
- Extend all CLI_TOOLS entries with 4 new fields: category, vendor, acpSpawnable, baseUrlSupport
- Add 13 new entries: roo, jcode, deepseek-tui, smelt, pi (code), aider, forge,
  gemini-cli, cursor-cli (code), goose, interpreter, warp, agent-deck (agent)
- Remove windsurf and amp (MITM backlog plan 11, D17)
- Result: 19 visible code entries + 6 agent entries (D15 cardinality)
- Add 5 new unit tests: cli-catalog-schema, cli-catalog-counts, cli-catalog-newentries,
  cli-catalog-removed, cli-catalog-acpspawnable
- Update existing tests to align with removed entries
2026-05-27 19:50:38 -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);
});