diff options
author | Fatih Acet <acetfatih@gmail.com> | 2019-04-24 22:50:55 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2019-04-24 22:50:55 +0000 |
commit | 045191628f8aa5a21c985776d6daf62a82da4161 (patch) | |
tree | 587354a320208e5ba5f78776e685e2215386e570 /spec/javascripts | |
parent | 66ff5f3dc6c19ea382192897395acfbd4adbd0c2 (diff) | |
parent | 4abd43609795e1cc0652396b6a00bc38ed237371 (diff) | |
download | gitlab-ce-045191628f8aa5a21c985776d6daf62a82da4161.tar.gz |
Merge branch 'fix-api-ide-relative-url-root' into 'master'
Fix API and IDE path with `/` relative_url_root
See merge request gitlab-org/gitlab-ce!27635
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/api_spec.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/javascripts/api_spec.js b/spec/javascripts/api_spec.js index e537e0e8afc..494b3b934a8 100644 --- a/spec/javascripts/api_spec.js +++ b/spec/javascripts/api_spec.js @@ -4,7 +4,7 @@ import Api from '~/api'; describe('Api', () => { const dummyApiVersion = 'v3000'; - const dummyUrlRoot = 'http://host.invalid'; + const dummyUrlRoot = '/gitlab'; const dummyGon = { api_version: dummyApiVersion, relative_url_root: dummyUrlRoot, @@ -32,6 +32,18 @@ describe('Api', () => { expect(builtUrl).toEqual(expectedOutput); }); + + [null, '', '/'].forEach(root => { + it(`works when relative_url_root is ${root}`, () => { + window.gon.relative_url_root = root; + const input = '/api/:version/foo/bar'; + const expectedOutput = `/api/${dummyApiVersion}/foo/bar`; + + const builtUrl = Api.buildUrl(input); + + expect(builtUrl).toEqual(expectedOutput); + }); + }); }); describe('group', () => { |