diff --git a/src/agents/pi-embedded-helpers.sanitizeuserfacingtext.e2e.test.ts b/src/agents/pi-embedded-helpers.sanitizeuserfacingtext.e2e.test.ts index 4d9817f59f6..ee24dac096d 100644 --- a/src/agents/pi-embedded-helpers.sanitizeuserfacingtext.e2e.test.ts +++ b/src/agents/pi-embedded-helpers.sanitizeuserfacingtext.e2e.test.ts @@ -191,9 +191,6 @@ describe("sanitizeToolCallId", () => { it("strips invalid characters", () => { expect(sanitizeToolCallId("call_abc|item:456")).toBe("callabcitem456"); }); - it("returns default for empty IDs", () => { - expect(sanitizeToolCallId("")).toBe("defaulttoolid"); - }); }); describe("strict mode (alphanumeric only)", () => { @@ -204,9 +201,6 @@ describe("sanitizeToolCallId", () => { "whatsapplogin17687998415271", ); }); - it("returns default for empty IDs", () => { - expect(sanitizeToolCallId("", "strict")).toBe("defaulttoolid"); - }); }); describe("strict9 mode (Mistral tool call IDs)", () => { @@ -214,9 +208,26 @@ describe("sanitizeToolCallId", () => { const out = sanitizeToolCallId("call_abc|item:456", "strict9"); expect(out).toMatch(/^[a-zA-Z0-9]{9}$/); }); - it("returns default for empty IDs", () => { - expect(sanitizeToolCallId("", "strict9")).toMatch(/^[a-zA-Z0-9]{9}$/); - }); + }); + + it.each([ + { + modeLabel: "default", + run: () => sanitizeToolCallId(""), + assert: (value: string) => expect(value).toBe("defaulttoolid"), + }, + { + modeLabel: "strict", + run: () => sanitizeToolCallId("", "strict"), + assert: (value: string) => expect(value).toBe("defaulttoolid"), + }, + { + modeLabel: "strict9", + run: () => sanitizeToolCallId("", "strict9"), + assert: (value: string) => expect(value).toMatch(/^[a-zA-Z0-9]{9}$/), + }, + ])("returns default for empty IDs in $modeLabel mode", ({ run, assert }) => { + assert(run()); }); });