-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update jira instance url input value
- Loading branch information
1 parent
bae1a57
commit 12e5c72
Showing
7 changed files
with
49 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { appendBrowseToUrl } from '../appendBrowseToUrl' | ||
|
||
describe('appendBrowseToUrl', () => { | ||
it('should append /browse/ to url without trailing slash', () => { | ||
const url = 'http://jira.example.com' | ||
const expected = 'http://jira.example.com/browse/' | ||
const result = appendBrowseToUrl(url) | ||
expect(result).toEqual(expected) | ||
}) | ||
|
||
it('should append /browse/ to url with trailing slash', () => { | ||
const url = 'http://jira.example.com/' | ||
const expected = 'http://jira.example.com/browse/' | ||
const result = appendBrowseToUrl(url) | ||
expect(result).toEqual(expected) | ||
}) | ||
|
||
it('should return empty string when given an empty string', () => { | ||
const url = '' | ||
const expected = '' | ||
const result = appendBrowseToUrl(url) | ||
expect(result).toEqual(expected) | ||
}) | ||
}) |
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,14 @@ | ||
/** | ||
* Appends '/browse/' to the provided URL. | ||
* | ||
* @param {string} url - The URL to modify. | ||
* @return {string} The modified URL. If the input URL is empty, it is returned unchanged. | ||
*/ | ||
export function appendBrowseToUrl(url: string): string { | ||
if (!url) return url | ||
|
||
// Ensure url ends with a slash | ||
const formattedUrl = url.endsWith('/') ? url : `${url}/` | ||
|
||
return `${formattedUrl}browse/` | ||
} |
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