Files
OmniRoute/tests/unit/copilot-runOmniRouteCli.test.ts
Diego Rodrigues de Sa e Souza 92715c8f2c Release v3.8.46
Release v3.8.46. Full changelog: CHANGELOG.md → [3.8.46]. Contributor attribution in the CHANGELOG entries.
2026-07-07 13:14:06 -03:00

36 lines
1.3 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
test("runOmniRouteCli: missing command returns error", async () => {
const { getCopilotTool } = await import("../../src/lib/copilot/tools.ts");
const tool = getCopilotTool("runOmniRouteCli");
assert.ok(tool);
const result = await tool.handler({});
assert.equal(result, "Please provide a command to execute.");
});
test("runOmniRouteCli: empty command returns error", async () => {
const { getCopilotTool } = await import("../../src/lib/copilot/tools.ts");
const tool = getCopilotTool("runOmniRouteCli");
assert.ok(tool);
const result = await tool.handler({ command: "" });
assert.equal(result, "Please provide a command to execute.");
});
test("runOmniRouteCli: returns CLI-not-found when omniroute unavailable", async () => {
const { getCopilotTool } = await import("../../src/lib/copilot/tools.ts");
const tool = getCopilotTool("runOmniRouteCli");
assert.ok(tool);
const originalPath = process.env.PATH;
try {
process.env.PATH = "";
const result = await tool.handler({ command: "health" });
assert.ok(
result.includes("omniroute CLI not found in PATH"),
`Expected CLI-not-found message, got: ${result}`
);
} finally {
process.env.PATH = originalPath;
}
});