diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/frontend/ide/lib/gitlab_web_ide/get_base_config_spec.js | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) | |
download | gitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
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.js | 18 |
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}`, + }); + }); }); |