summaryrefslogtreecommitdiff
path: root/spec/frontend/ide/lib/gitlab_web_ide/get_base_config_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/ide/lib/gitlab_web_ide/get_base_config_spec.js')
-rw-r--r--spec/frontend/ide/lib/gitlab_web_ide/get_base_config_spec.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/frontend/ide/lib/gitlab_web_ide/get_base_config_spec.js b/spec/frontend/ide/lib/gitlab_web_ide/get_base_config_spec.js
index 4b4e96f3b41..ed67a0948e4 100644
--- a/spec/frontend/ide/lib/gitlab_web_ide/get_base_config_spec.js
+++ b/spec/frontend/ide/lib/gitlab_web_ide/get_base_config_spec.js
@@ -3,20 +3,32 @@ import { TEST_HOST } from 'helpers/test_constants';
const TEST_GITLAB_WEB_IDE_PUBLIC_PATH = 'test/gitlab-web-ide/public/path';
const TEST_GITLAB_URL = 'https://gdk.test/';
+const TEST_RELATIVE_URL_ROOT = '/gl_rel_root';
describe('~/ide/lib/gitlab_web_ide/get_base_config', () => {
- it('returns base properties for @gitlab/web-ide config', () => {
+ beforeEach(() => {
// why: add trailing "/" to test that it gets removed
process.env.GITLAB_WEB_IDE_PUBLIC_PATH = `${TEST_GITLAB_WEB_IDE_PUBLIC_PATH}/`;
window.gon.gitlab_url = TEST_GITLAB_URL;
+ window.gon.relative_url_root = '';
+ });
- // act
+ it('with default, returns base properties for @gitlab/web-ide config', () => {
const actual = getBaseConfig();
- // asset
expect(actual).toEqual({
baseUrl: `${TEST_HOST}/${TEST_GITLAB_WEB_IDE_PUBLIC_PATH}`,
gitlabUrl: TEST_GITLAB_URL,
});
});
+
+ it('with relative_url_root, returns baseUrl with relative url root', () => {
+ window.gon.relative_url_root = TEST_RELATIVE_URL_ROOT;
+
+ const actual = getBaseConfig();
+
+ expect(actual).toMatchObject({
+ baseUrl: `${TEST_HOST}${TEST_RELATIVE_URL_ROOT}/${TEST_GITLAB_WEB_IDE_PUBLIC_PATH}`,
+ });
+ });
});