forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release_23.1' into release_23.2
- Loading branch information
Showing
5 changed files
with
98 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { copyLink } from "./utilities"; | ||
|
||
const writeText = jest.fn(); | ||
|
||
Object.assign(navigator, { | ||
clipboard: { | ||
writeText, | ||
}, | ||
}); | ||
|
||
describe("copyLink", () => { | ||
beforeEach(() => { | ||
(navigator.clipboard.writeText as jest.Mock).mockResolvedValue(undefined); | ||
}); | ||
|
||
it("should copy the link to the clipboard", () => { | ||
const toolId = "MyToolId"; | ||
copyLink(toolId); | ||
expect(writeText).toHaveBeenCalledTimes(1); | ||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining(toolId)); | ||
}); | ||
|
||
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")); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters