diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-29 18:08:58 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-29 18:08:58 +0000 |
commit | a16398e10f87edd229a12be2f1fc87cd4a76f902 (patch) | |
tree | c3f4db5dbf36a8470689cab3ad3bfe55aced5f1d /spec/frontend/lib/utils/url_utility_spec.js | |
parent | 8c2d06cba79ff8965a4de9467e05e80d7c7f449e (diff) | |
download | gitlab-ce-a16398e10f87edd229a12be2f1fc87cd4a76f902.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib/utils/url_utility_spec.js')
-rw-r--r-- | spec/frontend/lib/utils/url_utility_spec.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/url_utility_spec.js b/spec/frontend/lib/utils/url_utility_spec.js index 766da7034d9..312e4f636c3 100644 --- a/spec/frontend/lib/utils/url_utility_spec.js +++ b/spec/frontend/lib/utils/url_utility_spec.js @@ -1062,4 +1062,28 @@ describe('URL utility', () => { expect(urlUtils.PROMO_URL).toBe(url); }); }); + + describe('removeUrlProtocol', () => { + it.each` + input | output + ${'http://gitlab.com'} | ${'gitlab.com'} + ${'https://gitlab.com'} | ${'gitlab.com'} + ${'foo:bar.com'} | ${'bar.com'} + ${'gitlab.com'} | ${'gitlab.com'} + `('transforms $input to $output', ({ input, output }) => { + expect(urlUtils.removeUrlProtocol(input)).toBe(output); + }); + }); + + describe('removeLastSlashInUrlPath', () => { + it.each` + input | output + ${'https://www.gitlab.com/path/'} | ${'https://www.gitlab.com/path'} + ${'https://www.gitlab.com/?query=search'} | ${'https://www.gitlab.com?query=search'} + ${'https://www.gitlab.com/#fragment'} | ${'https://www.gitlab.com#fragment'} + ${'https://www.gitlab.com/hello'} | ${'https://www.gitlab.com/hello'} + `('transforms $input to $output', ({ input, output }) => { + expect(urlUtils.removeLastSlashInUrlPath(input)).toBe(output); + }); + }); }); |