From d7877275610668b77fb0518d935781ad7733ddbe Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Tue, 6 Feb 2024 14:53:17 +0100 Subject: [PATCH] Add test case for tool IDs with `+` --- client/src/components/Tool/utilities.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/components/Tool/utilities.test.ts b/client/src/components/Tool/utilities.test.ts index 2a22aaddfbe9..8295d1e2bfe6 100644 --- a/client/src/components/Tool/utilities.test.ts +++ b/client/src/components/Tool/utilities.test.ts @@ -20,10 +20,17 @@ describe("copyLink", () => { expect(writeText).toHaveBeenCalledWith(expect.stringContaining(toolId)); }); - it("should encode the tool id", () => { + it("should encode the tool id with spaces", () => { const toolId = "My Tool Id"; copyLink(toolId); expect(writeText).toHaveBeenCalledTimes(1); expect(writeText).toHaveBeenCalledWith(expect.stringContaining("My%20Tool%20Id")); }); + + it("should not encode the character '+' in the tool id", () => { + const toolId = "My Tool Id+1"; + copyLink(toolId); + expect(writeText).toHaveBeenCalledTimes(1); + expect(writeText).toHaveBeenCalledWith(expect.stringContaining("My%20Tool%20Id+1")); + }); });