Skip to content

Commit

Permalink
Add test case for tool IDs with +
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Feb 6, 2024
1 parent 22d5071 commit d787727
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion client/src/components/Tool/utilities.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
});
});

0 comments on commit d787727

Please sign in to comment.