49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { readCodexPluginConfig, resolveCodexAppServerRuntimeOptions } from "./config.js";
|
|
|
|
describe("Codex app-server config", () => {
|
|
it("parses typed plugin config before falling back to environment knobs", () => {
|
|
const runtime = resolveCodexAppServerRuntimeOptions({
|
|
pluginConfig: {
|
|
appServer: {
|
|
transport: "websocket",
|
|
url: "ws://127.0.0.1:39175",
|
|
headers: { "X-Test": "yes" },
|
|
approvalPolicy: "on-request",
|
|
sandbox: "danger-full-access",
|
|
approvalsReviewer: "guardian_subagent",
|
|
serviceTier: "priority",
|
|
},
|
|
},
|
|
env: {
|
|
OPENCLAW_CODEX_APP_SERVER_APPROVAL_POLICY: "never",
|
|
OPENCLAW_CODEX_APP_SERVER_SANDBOX: "read-only",
|
|
},
|
|
});
|
|
|
|
expect(runtime).toEqual(
|
|
expect.objectContaining({
|
|
approvalPolicy: "on-request",
|
|
sandbox: "danger-full-access",
|
|
approvalsReviewer: "guardian_subagent",
|
|
serviceTier: "priority",
|
|
start: expect.objectContaining({
|
|
transport: "websocket",
|
|
url: "ws://127.0.0.1:39175",
|
|
headers: { "X-Test": "yes" },
|
|
}),
|
|
}),
|
|
);
|
|
});
|
|
|
|
it("rejects malformed plugin config instead of treating freeform strings as control values", () => {
|
|
expect(
|
|
readCodexPluginConfig({
|
|
appServer: {
|
|
approvalPolicy: "always",
|
|
},
|
|
}),
|
|
).toEqual({});
|
|
});
|
|
});
|