diff --git a/tests/translator/claude-claude-stream-decloak.test.js b/tests/translator/claude-claude-stream-decloak.test.js index 35c0fcdf..d223129c 100644 --- a/tests/translator/claude-claude-stream-decloak.test.js +++ b/tests/translator/claude-claude-stream-decloak.test.js @@ -36,10 +36,10 @@ describe("Claude → Claude streaming passthrough (OAuth tool cloak)", () => { expect(outText).toBe(textChunk); }); - it("is a no-op when no cloak map is present", () => { + it("falls back to suffix-stripping when no cloak map is present", () => { const chunk = toolUseStart(CLOAKED); const [out] = translateResponse(FORMATS.CLAUDE, FORMATS.CLAUDE, chunk, {}); - expect(out).toBe(chunk); + expect(out.content_block.name).toBe("run_code"); }); it("tolerates the null flush chunk", () => { diff --git a/tests/unit/claude-cloaking.test.js b/tests/unit/claude-cloaking.test.js index 6f06e594..bc4cf541 100644 --- a/tests/unit/claude-cloaking.test.js +++ b/tests/unit/claude-cloaking.test.js @@ -117,7 +117,8 @@ describe("decloakStreamChunk", () => { it("tolerates null chunks and missing maps (stream flush path)", () => { expect(decloakStreamChunk(null, toolNameMap)).toBeNull(); - expect(decloakStreamChunk(toolUseStart("run_code" + CLAUDE_TOOL_SUFFIX), null).content_block.name).toBe("run_code" + CLAUDE_TOOL_SUFFIX); - expect(decloakStreamChunk(toolUseStart("run_code" + CLAUDE_TOOL_SUFFIX), new Map()).content_block.name).toBe("run_code" + CLAUDE_TOOL_SUFFIX); + expect(decloakStreamChunk(toolUseStart("run_code" + CLAUDE_TOOL_SUFFIX), null).content_block.name).toBe("run_code"); + expect(decloakStreamChunk(toolUseStart("run_code" + CLAUDE_TOOL_SUFFIX), new Map()).content_block.name).toBe("run_code"); + expect(decloakStreamChunk(toolUseStart("uncloaked_tool"), null).content_block.name).toBe("uncloaked_tool"); }); });