Files
AgentCompany/tests/unit/connectors.spec.ts
T
ZacharyZhang-NY 88a1f8b334 refactor(connectors): drop dead CLI command field after pi-mono migration
The CLI-adapter era `connector.command` field became vestigial once every
provider dispatch went through pi-ai. The schema still required a non-empty
command, so onboarding saveConnector silently rejected every Pi Mono row
(which carries an empty default). Remove the field from the payload chain
(renderer → IPC schema → DB CRUD → run dispatch → worker job), narrow
RunJob.taskId to match EnqueueRunPayload, and drop the dead helper plus
its test. Schema column stays NOT NULL for DB compatibility; seedConnectors
writes a literal empty string so no migration is needed.
2026-04-18 23:09:59 -04:00

40 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { buildDefaultConnectorRows, parseEnvBindingText } from "../../src/main/connectors";
describe("parseEnvBindingText", () => {
it("ignores comments and blank lines while preserving values with equals", () => {
expect(
parseEnvBindingText(`
# comment
OPENAI_API_KEY=vault-openai
CUSTOM=value=with=equals
`),
).toEqual({
OPENAI_API_KEY: "vault-openai",
CUSTOM: "value=with=equals",
});
});
});
describe("buildDefaultConnectorRows", () => {
it("preserves previously saved connector overrides", () => {
const rows = buildDefaultConnectorRows([
{
id: "openai-codex",
status: "ready",
notes: "custom note",
},
]);
const codex = rows.find((row) => row.id === "openai-codex");
if (!codex) {
throw new Error("openai-codex connector not found in default rows.");
}
expect(codex.id).toBe("openai-codex");
expect(codex.status).toBe("ready");
expect(codex.notes).toBe("custom note");
expect(codex.capabilityMatrix.structuredTranscript).toBe(true);
});
});