summaryrefslogtreecommitdiff
path: root/spec/frontend/lib/utils/url_utility_spec.js
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-13 09:08:01 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-13 09:08:01 +0000
commit17b91a3c6ab73fff087e91665e9afb8046cbf045 (patch)
tree04655a8630478d9846571875f69469f018d4bdcc /spec/frontend/lib/utils/url_utility_spec.js
parentb3db40398ce9ad335270617e834fde96d46f90ea (diff)
downloadgitlab-ce-17b91a3c6ab73fff087e91665e9afb8046cbf045.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.js24
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 8244acbceea..97f7f05cd85 100644
--- a/spec/frontend/lib/utils/url_utility_spec.js
+++ b/spec/frontend/lib/utils/url_utility_spec.js
@@ -298,4 +298,28 @@ describe('URL utility', () => {
expect(urlUtils.objectToQuery(searchQueryObject)).toEqual('one=1&two=2');
});
});
+
+ describe('joinPaths', () => {
+ it.each`
+ paths | expected
+ ${['foo', 'bar']} | ${'foo/bar'}
+ ${['foo/', 'bar']} | ${'foo/bar'}
+ ${['foo//', 'bar']} | ${'foo/bar'}
+ ${['abc/', '/def']} | ${'abc/def'}
+ ${['foo', '/bar']} | ${'foo/bar'}
+ ${['foo', '/bar/']} | ${'foo/bar/'}
+ ${['foo', '//bar/']} | ${'foo/bar/'}
+ ${['foo', '', '/bar']} | ${'foo/bar'}
+ ${['foo', '/bar', '']} | ${'foo/bar'}
+ ${['/', '', 'foo/bar/ ', '', '/ninja']} | ${'/foo/bar/ /ninja'}
+ ${['', '/ninja', '/', ' ', '', 'bar', ' ']} | ${'/ninja/ /bar/ '}
+ ${['http://something/bar/', 'foo']} | ${'http://something/bar/foo'}
+ ${['foo/bar', null, 'ninja', null]} | ${'foo/bar/ninja'}
+ ${[null, 'abc/def', 'zoo']} | ${'abc/def/zoo'}
+ ${['', '', '']} | ${''}
+ ${['///', '/', '//']} | ${'/'}
+ `('joins paths $paths => $expected', ({ paths, expected }) => {
+ expect(urlUtils.joinPaths(...paths)).toBe(expected);
+ });
+ });
});