Files
OmniRoute/tests/unit/copilot-runOmniRouteCli.test.ts
Jan Leon 958260a5c9 Add Codex reset-credit redemption flow (#6361)
Codex reset-credit redemption flow (#6361). Tests 56/56; kept release 'Banked Reset Credits' label (reverted cosmetic rename that broke 2 release tests). Integrated into release/v3.8.46.
2026-07-06 21:50:27 -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;
}
});