From e8d63b8bd07eefacbc1ba70ad229cb95d241f47a Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 8 May 2026 11:13:32 +0100 Subject: [PATCH] test: clarify update plan tool assertions --- src/agents/openclaw-tools.update-plan.test.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/agents/openclaw-tools.update-plan.test.ts b/src/agents/openclaw-tools.update-plan.test.ts index e6d8c8bddc3..31dd3b8c9c3 100644 --- a/src/agents/openclaw-tools.update-plan.test.ts +++ b/src/agents/openclaw-tools.update-plan.test.ts @@ -11,6 +11,10 @@ function expectUpdatePlanEnabled(params: UpdatePlanGatingParams, expected: boole expect(isUpdatePlanToolEnabledForOpenClawTools(params)).toBe(expected); } +function toolNames(tools: ReturnType): string[] { + return tools.map((tool) => tool.name); +} + function openAiGpt5Params( config: OpenClawConfig, overrides: Partial = {}, @@ -48,8 +52,8 @@ describe("openclaw-tools update_plan gating", () => { modelId: "claude-sonnet-4-6", }); - expect(defaultTools.some((tool) => tool.name === "update_plan")).toBe(false); - expect(emptyAllowlistTools.some((tool) => tool.name === "update_plan")).toBe(false); + expect(toolNames(defaultTools)).not.toContain("update_plan"); + expect(toolNames(emptyAllowlistTools)).not.toContain("update_plan"); }); it("wraps constructed tools with before-tool-call hooks by default", () => { @@ -95,7 +99,7 @@ describe("openclaw-tools update_plan gating", () => { modelId: "claude-sonnet-4-6", }); - expect(tools.some((tool) => tool.name === "update_plan")).toBe(true); + expect(toolNames(tools)).toContain("update_plan"); }); it("registers update_plan when a config allowlist group includes it", () => { @@ -106,7 +110,7 @@ describe("openclaw-tools update_plan gating", () => { modelId: "claude-sonnet-4-6", }); - expect(tools.some((tool) => tool.name === "update_plan")).toBe(true); + expect(toolNames(tools)).toContain("update_plan"); }); it("registers update_plan when a runtime allowlist group includes it", () => { @@ -118,7 +122,7 @@ describe("openclaw-tools update_plan gating", () => { modelId: "claude-sonnet-4-6", }); - expect(tools.some((tool) => tool.name === "update_plan")).toBe(true); + expect(toolNames(tools)).toContain("update_plan"); }); it("respects deny policy while constructing update_plan for grouped allowlists", () => { @@ -131,7 +135,7 @@ describe("openclaw-tools update_plan gating", () => { modelId: "claude-sonnet-4-6", }); - expect(tools.some((tool) => tool.name === "update_plan")).toBe(false); + expect(toolNames(tools)).not.toContain("update_plan"); }); it("auto-enables update_plan for unconfigured GPT-5 openai runs", () => {