diff --git a/src/config/config-misc.test.ts b/src/config/config-misc.test.ts index 54caaf7fdcf..e1c02160b67 100644 --- a/src/config/config-misc.test.ts +++ b/src/config/config-misc.test.ts @@ -88,6 +88,62 @@ describe("talk.voiceAliases", () => { }); }); +describe("gateway.remote.transport", () => { + it("accepts direct transport", () => { + const res = validateConfigObject({ + gateway: { + remote: { + transport: "direct", + url: "wss://gateway.example.ts.net", + }, + }, + }); + expect(res.ok).toBe(true); + }); + + it("rejects unknown transport", () => { + const res = validateConfigObject({ + gateway: { + remote: { + transport: "udp", + }, + }, + }); + expect(res.ok).toBe(false); + if (!res.ok) { + expect(res.issues[0]?.path).toBe("gateway.remote.transport"); + } + }); +}); + +describe("gateway.tools config", () => { + it("accepts gateway.tools allow and deny lists", () => { + const res = validateConfigObject({ + gateway: { + tools: { + allow: ["gateway"], + deny: ["sessions_spawn", "sessions_send"], + }, + }, + }); + expect(res.ok).toBe(true); + }); + + it("rejects invalid gateway.tools values", () => { + const res = validateConfigObject({ + gateway: { + tools: { + allow: "gateway", + }, + }, + }); + expect(res.ok).toBe(false); + if (!res.ok) { + expect(res.issues[0]?.path).toBe("gateway.tools.allow"); + } + }); +}); + describe("cron webhook schema", () => { it("accepts cron.webhook and cron.webhookToken", () => { const res = OpenClawSchema.safeParse({ diff --git a/src/config/config.gateway-remote-transport.test.ts b/src/config/config.gateway-remote-transport.test.ts deleted file mode 100644 index a729a163772..00000000000 --- a/src/config/config.gateway-remote-transport.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { validateConfigObject } from "./config.js"; - -describe("gateway.remote.transport", () => { - it("accepts direct transport", () => { - const res = validateConfigObject({ - gateway: { - remote: { - transport: "direct", - url: "wss://gateway.example.ts.net", - }, - }, - }); - expect(res.ok).toBe(true); - }); - - it("rejects unknown transport", () => { - const res = validateConfigObject({ - gateway: { - remote: { - transport: "udp", - }, - }, - }); - expect(res.ok).toBe(false); - if (!res.ok) { - expect(res.issues[0]?.path).toBe("gateway.remote.transport"); - } - }); -}); diff --git a/src/config/config.gateway-tools-config.test.ts b/src/config/config.gateway-tools-config.test.ts deleted file mode 100644 index 022dfc79abd..00000000000 --- a/src/config/config.gateway-tools-config.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { validateConfigObject } from "./config.js"; - -describe("gateway.tools config", () => { - it("accepts gateway.tools allow and deny lists", () => { - const res = validateConfigObject({ - gateway: { - tools: { - allow: ["gateway"], - deny: ["sessions_spawn", "sessions_send"], - }, - }, - }); - expect(res.ok).toBe(true); - }); - - it("rejects invalid gateway.tools values", () => { - const res = validateConfigObject({ - gateway: { - tools: { - allow: "gateway", - }, - }, - }); - expect(res.ok).toBe(false); - if (!res.ok) { - expect(res.issues[0]?.path).toBe("gateway.tools.allow"); - } - }); -});