Files
agentdock/runner/integrations.test.js

36 lines
1.8 KiB
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
import { parseCcProviderList, parseMulticaConfig } from "./integrations.js";
test("parses CC Switch provider table without exposing URL paths", () => {
const result = parseCcProviderList(`
┌───┬────────────────┬─────────────────┬────────────────────────────┐
│ ┆ ID ┆ Name ┆ API URL │
╞═══╪════════════════╪═════════════════╪════════════════════════════╡
│ ✓ ┆ codex-official ┆ OpenAI Official ┆ N/A │
│ ┆ relay-one ┆ Relay One ┆ https://api.example/a/key │
└───┴────────────────┴─────────────────┴────────────────────────────┘
→ Current: codex-official
`);
assert.equal(result.currentProviderId, "codex-official");
assert.deepEqual(result.providers, [
{ id: "codex-official", name: "OpenAI Official", endpoint: null, active: true },
{ id: "relay-one", name: "Relay One", endpoint: "https://api.example", active: false },
]);
});
test("parses Multica config and marks an authenticated workspace configured", () => {
const result = parseMulticaConfig(`
Config file: /home/ai/.multica/config.json
server_url: https://multica-api.example
app_url: https://multica.example
workspace_id: ws-123
`);
assert.deepEqual(result, {
serverUrl: "https://multica-api.example",
appUrl: "https://multica.example",
workspaceId: "ws-123",
configured: true,
});
});