mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-29 18:12:52 +00:00
test: validate Codex app-server config
This commit is contained in:
48
extensions/codex/src/app-server/config.test.ts
Normal file
48
extensions/codex/src/app-server/config.test.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
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({});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user