fixed karma

This commit is contained in:
Phil Hughes 2018-06-07 15:11:10 +01:00
parent 02a2ca6ae4
commit 132db99a5b
No known key found for this signature in database
GPG Key ID: 32245528C52E0F9F
2 changed files with 6 additions and 2 deletions

View File

@ -85,9 +85,9 @@ export function redirectTo(url) {
}
export function webIDEUrl(route = undefined) {
let returnUrl = `${gon.relative_url_root}/-/ide/`;
let returnUrl = `${gon.relative_url_root || ''}/-/ide/`;
if (route) {
returnUrl += `project${route.replace(new RegExp(`^${gon.relative_url_root}`), '')}`;
returnUrl += `project${route.replace(new RegExp(`^${gon.relative_url_root || ''}`), '')}`;
}
return returnUrl;
}

View File

@ -2,6 +2,10 @@ import { webIDEUrl } from '~/lib/utils/url_utility';
describe('URL utility', () => {
describe('webIDEUrl', () => {
afterEach(() => {
gon.relative_url_root = '';
});
describe('without relative_url_root', () => {
it('returns IDE path with route', () => {
expect(webIDEUrl('/gitlab-org/gitlab-ce/merge_requests/1')).toBe(