Commit 862123d8 authored by Lukas Eipert's avatar Lukas Eipert

Replace `gl.TEST_HOST` with `TEST_HOST`

Use a proper import for TEST_HOST
parent 0c004397
import GfmAutoCompleteEE from 'ee/gfm_auto_complete'; import GfmAutoCompleteEE from 'ee/gfm_auto_complete';
import $ from 'jquery'; import $ from 'jquery';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('GfmAutoCompleteEE', () => { describe('GfmAutoCompleteEE', () => {
const dataSources = { const dataSources = {
labels: `${gl.TEST_HOST}/autocomplete_sources/labels`, labels: `${TEST_HOST}/autocomplete_sources/labels`,
}; };
let instance; let instance;
const $input = $('<input type="text" />'); const $input = $('<input type="text" />');
......
...@@ -2,6 +2,7 @@ import MockAdapter from 'axios-mock-adapter'; ...@@ -2,6 +2,7 @@ import MockAdapter from 'axios-mock-adapter';
import testAction from 'helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import * as actions from '~/batch_comments/stores/modules/batch_comments/actions'; import * as actions from '~/batch_comments/stores/modules/batch_comments/actions';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('Batch comments store actions', () => { describe('Batch comments store actions', () => {
let res = {}; let res = {};
...@@ -33,7 +34,7 @@ describe('Batch comments store actions', () => { ...@@ -33,7 +34,7 @@ describe('Batch comments store actions', () => {
testAction( testAction(
actions.addDraftToDiscussion, actions.addDraftToDiscussion,
{ endpoint: gl.TEST_HOST, data: 'test' }, { endpoint: TEST_HOST, data: 'test' },
null, null,
[{ type: 'ADD_NEW_DRAFT', payload: res }], [{ type: 'ADD_NEW_DRAFT', payload: res }],
[], [],
...@@ -46,7 +47,7 @@ describe('Batch comments store actions', () => { ...@@ -46,7 +47,7 @@ describe('Batch comments store actions', () => {
testAction( testAction(
actions.addDraftToDiscussion, actions.addDraftToDiscussion,
{ endpoint: gl.TEST_HOST, data: 'test' }, { endpoint: TEST_HOST, data: 'test' },
null, null,
[], [],
[], [],
...@@ -62,7 +63,7 @@ describe('Batch comments store actions', () => { ...@@ -62,7 +63,7 @@ describe('Batch comments store actions', () => {
testAction( testAction(
actions.createNewDraft, actions.createNewDraft,
{ endpoint: gl.TEST_HOST, data: 'test' }, { endpoint: TEST_HOST, data: 'test' },
null, null,
[{ type: 'ADD_NEW_DRAFT', payload: res }], [{ type: 'ADD_NEW_DRAFT', payload: res }],
[], [],
...@@ -73,14 +74,7 @@ describe('Batch comments store actions', () => { ...@@ -73,14 +74,7 @@ describe('Batch comments store actions', () => {
it('does not commit ADD_NEW_DRAFT if errors returned', done => { it('does not commit ADD_NEW_DRAFT if errors returned', done => {
mock.onAny().reply(500); mock.onAny().reply(500);
testAction( testAction(actions.createNewDraft, { endpoint: TEST_HOST, data: 'test' }, null, [], [], done);
actions.createNewDraft,
{ endpoint: gl.TEST_HOST, data: 'test' },
null,
[],
[],
done,
);
}); });
}); });
...@@ -90,7 +84,7 @@ describe('Batch comments store actions', () => { ...@@ -90,7 +84,7 @@ describe('Batch comments store actions', () => {
beforeEach(() => { beforeEach(() => {
getters = { getters = {
getNotesData: { getNotesData: {
draftsDiscardPath: gl.TEST_HOST, draftsDiscardPath: TEST_HOST,
}, },
}; };
}); });
...@@ -137,7 +131,7 @@ describe('Batch comments store actions', () => { ...@@ -137,7 +131,7 @@ describe('Batch comments store actions', () => {
beforeEach(() => { beforeEach(() => {
getters = { getters = {
getNotesData: { getNotesData: {
draftsPath: gl.TEST_HOST, draftsPath: TEST_HOST,
}, },
}; };
}); });
...@@ -171,7 +165,7 @@ describe('Batch comments store actions', () => { ...@@ -171,7 +165,7 @@ describe('Batch comments store actions', () => {
dispatch = jest.fn(); dispatch = jest.fn();
commit = jest.fn(); commit = jest.fn();
getters = { getters = {
getNotesData: { draftsPublishPath: gl.TEST_HOST, discussionsPath: gl.TEST_HOST }, getNotesData: { draftsPublishPath: TEST_HOST, discussionsPath: TEST_HOST },
}; };
rootGetters = { discussionsStructuredByLineCode: 'discussions' }; rootGetters = { discussionsStructuredByLineCode: 'discussions' };
}); });
...@@ -208,7 +202,7 @@ describe('Batch comments store actions', () => { ...@@ -208,7 +202,7 @@ describe('Batch comments store actions', () => {
describe('discardReview', () => { describe('discardReview', () => {
it('commits mutations', done => { it('commits mutations', done => {
const getters = { const getters = {
getNotesData: { draftsDiscardPath: gl.TEST_HOST }, getNotesData: { draftsDiscardPath: TEST_HOST },
}; };
const commit = jest.fn(); const commit = jest.fn();
mock.onAny().reply(200); mock.onAny().reply(200);
...@@ -225,7 +219,7 @@ describe('Batch comments store actions', () => { ...@@ -225,7 +219,7 @@ describe('Batch comments store actions', () => {
it('commits error mutations', done => { it('commits error mutations', done => {
const getters = { const getters = {
getNotesData: { draftsDiscardPath: gl.TEST_HOST }, getNotesData: { draftsDiscardPath: TEST_HOST },
}; };
const commit = jest.fn(); const commit = jest.fn();
mock.onAny().reply(500); mock.onAny().reply(500);
...@@ -247,7 +241,7 @@ describe('Batch comments store actions', () => { ...@@ -247,7 +241,7 @@ describe('Batch comments store actions', () => {
beforeEach(() => { beforeEach(() => {
getters = { getters = {
getNotesData: { getNotesData: {
draftsPath: gl.TEST_HOST, draftsPath: TEST_HOST,
}, },
}; };
}); });
......
...@@ -3,14 +3,15 @@ import { mount } from '@vue/test-utils'; ...@@ -3,14 +3,15 @@ import { mount } from '@vue/test-utils';
import boardsStore from '~/boards/stores/boards_store'; import boardsStore from '~/boards/stores/boards_store';
import boardForm from '~/boards/components/board_form.vue'; import boardForm from '~/boards/components/board_form.vue';
import DeprecatedModal from '~/vue_shared/components/deprecated_modal.vue'; import DeprecatedModal from '~/vue_shared/components/deprecated_modal.vue';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('board_form.vue', () => { describe('board_form.vue', () => {
let wrapper; let wrapper;
const propsData = { const propsData = {
canAdminBoard: false, canAdminBoard: false,
labelsPath: `${gl.TEST_HOST}/labels/path`, labelsPath: `${TEST_HOST}/labels/path`,
milestonePath: `${gl.TEST_HOST}/milestone/path`, milestonePath: `${TEST_HOST}/milestone/path`,
}; };
const findModal = () => wrapper.find(DeprecatedModal); const findModal = () => wrapper.find(DeprecatedModal);
......
...@@ -57,6 +57,7 @@ import { mergeUrlParams } from '~/lib/utils/url_utility'; ...@@ -57,6 +57,7 @@ import { mergeUrlParams } from '~/lib/utils/url_utility';
import { useLocalStorageSpy } from 'helpers/local_storage_helper'; import { useLocalStorageSpy } from 'helpers/local_storage_helper';
import { diffMetadata } from '../mock_data/diff_metadata'; import { diffMetadata } from '../mock_data/diff_metadata';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { TEST_HOST } from 'jest/helpers/test_constants';
jest.mock('~/flash', () => jest.fn()); jest.mock('~/flash', () => jest.fn());
...@@ -1252,12 +1253,12 @@ describe('DiffsStoreActions', () => { ...@@ -1252,12 +1253,12 @@ describe('DiffsStoreActions', () => {
describe('success', () => { describe('success', () => {
beforeEach(() => { beforeEach(() => {
mock.onGet(`${gl.TEST_HOST}/context`).replyOnce(200, ['test']); mock.onGet(`${TEST_HOST}/context`).replyOnce(200, ['test']);
}); });
it('commits the success and dispatches an action to expand the new lines', done => { it('commits the success and dispatches an action to expand the new lines', done => {
const file = { const file = {
context_lines_path: `${gl.TEST_HOST}/context`, context_lines_path: `${TEST_HOST}/context`,
file_path: 'test', file_path: 'test',
file_hash: 'test', file_hash: 'test',
}; };
...@@ -1274,13 +1275,13 @@ describe('DiffsStoreActions', () => { ...@@ -1274,13 +1275,13 @@ describe('DiffsStoreActions', () => {
describe('error', () => { describe('error', () => {
beforeEach(() => { beforeEach(() => {
mock.onGet(`${gl.TEST_HOST}/context`).replyOnce(500); mock.onGet(`${TEST_HOST}/context`).replyOnce(500);
}); });
it('dispatches receiveFullDiffError', done => { it('dispatches receiveFullDiffError', done => {
testAction( testAction(
fetchFullDiff, fetchFullDiff,
{ context_lines_path: `${gl.TEST_HOST}/context`, file_path: 'test', file_hash: 'test' }, { context_lines_path: `${TEST_HOST}/context`, file_path: 'test', file_hash: 'test' },
null, null,
[], [],
[{ type: 'receiveFullDiffError', payload: 'test' }], [{ type: 'receiveFullDiffError', payload: 'test' }],
...@@ -1444,7 +1445,7 @@ describe('DiffsStoreActions', () => { ...@@ -1444,7 +1445,7 @@ describe('DiffsStoreActions', () => {
describe('setSuggestPopoverDismissed', () => { describe('setSuggestPopoverDismissed', () => {
it('commits SET_SHOW_SUGGEST_POPOVER', done => { it('commits SET_SHOW_SUGGEST_POPOVER', done => {
const state = { dismissEndpoint: `${gl.TEST_HOST}/-/user_callouts` }; const state = { dismissEndpoint: `${TEST_HOST}/-/user_callouts` };
const mock = new MockAdapter(axios); const mock = new MockAdapter(axios);
mock.onPost(state.dismissEndpoint).reply(200, {}); mock.onPost(state.dismissEndpoint).reply(200, {});
......
...@@ -4,6 +4,7 @@ import AjaxCache from '~/lib/utils/ajax_cache'; ...@@ -4,6 +4,7 @@ import AjaxCache from '~/lib/utils/ajax_cache';
import UsersCache from '~/lib/utils/users_cache'; import UsersCache from '~/lib/utils/users_cache';
import DropdownUtils from '~/filtered_search//dropdown_utils'; import DropdownUtils from '~/filtered_search//dropdown_utils';
import FilteredSearchSpecHelper from '../helpers/filtered_search_spec_helper'; import FilteredSearchSpecHelper from '../helpers/filtered_search_spec_helper';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('Filtered Search Visual Tokens', () => { describe('Filtered Search Visual Tokens', () => {
const findElements = tokenElement => { const findElements = tokenElement => {
...@@ -106,7 +107,7 @@ describe('Filtered Search Visual Tokens', () => { ...@@ -106,7 +107,7 @@ describe('Filtered Search Visual Tokens', () => {
it('escapes user name when creating token', done => { it('escapes user name when creating token', done => {
const dummyUser = { const dummyUser = {
name: '<script>', name: '<script>',
avatar_url: `${gl.TEST_HOST}/mypics/avatar.png`, avatar_url: `${TEST_HOST}/mypics/avatar.png`,
}; };
const { subject, tokenValueContainer, tokenValueElement } = findElements(authorToken); const { subject, tokenValueContainer, tokenValueElement } = findElements(authorToken);
const tokenValue = tokenValueElement.innerText; const tokenValue = tokenValueElement.innerText;
......
...@@ -7,6 +7,7 @@ import { createStore } from '~/ide/stores'; ...@@ -7,6 +7,7 @@ import { createStore } from '~/ide/stores';
import service from '~/ide/services'; import service from '~/ide/services';
import { createRouter } from '~/ide/ide_router'; import { createRouter } from '~/ide/ide_router';
import { file, createEntriesFromPaths } from '../../helpers'; import { file, createEntriesFromPaths } from '../../helpers';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('Multi-file store tree actions', () => { describe('Multi-file store tree actions', () => {
let projectTree; let projectTree;
...@@ -97,7 +98,7 @@ describe('Multi-file store tree actions', () => { ...@@ -97,7 +98,7 @@ describe('Multi-file store tree actions', () => {
store.state.projects = { store.state.projects = {
'abc/def': { 'abc/def': {
web_url: `${gl.TEST_HOST}/files`, web_url: `${TEST_HOST}/files`,
branches: { branches: {
'master-testing': { 'master-testing': {
commit: { commit: {
......
import * as commentIndicatorHelper from '~/image_diff/helpers/comment_indicator_helper'; import * as commentIndicatorHelper from '~/image_diff/helpers/comment_indicator_helper';
import * as mockData from '../mock_data'; import * as mockData from '../mock_data';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('commentIndicatorHelper', () => { describe('commentIndicatorHelper', () => {
const { coordinate } = mockData; const { coordinate } = mockData;
...@@ -52,7 +53,7 @@ describe('commentIndicatorHelper', () => { ...@@ -52,7 +53,7 @@ describe('commentIndicatorHelper', () => {
beforeEach(() => { beforeEach(() => {
containerEl.innerHTML = ` containerEl.innerHTML = `
<div class="comment-indicator" style="left:${coordinate.x}px; top: ${coordinate.y}px;"> <div class="comment-indicator" style="left:${coordinate.x}px; top: ${coordinate.y}px;">
<img src="${gl.TEST_HOST}/image.png"> <img src="${TEST_HOST}/image.png">
</div> </div>
`; `;
result = commentIndicatorHelper.removeCommentIndicator(containerEl); result = commentIndicatorHelper.removeCommentIndicator(containerEl);
......
import * as utilsHelper from '~/image_diff/helpers/utils_helper'; import * as utilsHelper from '~/image_diff/helpers/utils_helper';
import ImageBadge from '~/image_diff/image_badge'; import ImageBadge from '~/image_diff/image_badge';
import * as mockData from '../mock_data'; import * as mockData from '../mock_data';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('utilsHelper', () => { describe('utilsHelper', () => {
const { noteId, discussionId, image, imageProperties, imageMeta } = mockData; const { noteId, discussionId, image, imageProperties, imageMeta } = mockData;
...@@ -36,7 +37,7 @@ describe('utilsHelper', () => { ...@@ -36,7 +37,7 @@ describe('utilsHelper', () => {
beforeEach(() => { beforeEach(() => {
const imageFrameEl = document.createElement('div'); const imageFrameEl = document.createElement('div');
imageFrameEl.innerHTML = ` imageFrameEl.innerHTML = `
<img src="${gl.TEST_HOST}/image.png"> <img src="${TEST_HOST}/image.png">
`; `;
discussionEl = document.createElement('div'); discussionEl = document.createElement('div');
discussionEl.dataset.discussionId = discussionId; discussionEl.dataset.discussionId = discussionId;
......
...@@ -2,6 +2,7 @@ import ImageDiff from '~/image_diff/image_diff'; ...@@ -2,6 +2,7 @@ import ImageDiff from '~/image_diff/image_diff';
import * as imageUtility from '~/lib/utils/image_utility'; import * as imageUtility from '~/lib/utils/image_utility';
import imageDiffHelper from '~/image_diff/helpers/index'; import imageDiffHelper from '~/image_diff/helpers/index';
import * as mockData from './mock_data'; import * as mockData from './mock_data';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('ImageDiff', () => { describe('ImageDiff', () => {
let element; let element;
...@@ -12,7 +13,7 @@ describe('ImageDiff', () => { ...@@ -12,7 +13,7 @@ describe('ImageDiff', () => {
<div id="element"> <div id="element">
<div class="diff-file"> <div class="diff-file">
<div class="js-image-frame"> <div class="js-image-frame">
<img src="${gl.TEST_HOST}/image.png"> <img src="${TEST_HOST}/image.png">
<div class="comment-indicator"></div> <div class="comment-indicator"></div>
<div id="badge-1" class="badge">1</div> <div id="badge-1" class="badge">1</div>
<div id="badge-2" class="badge">2</div> <div id="badge-2" class="badge">2</div>
......
...@@ -2,6 +2,7 @@ import ReplacedImageDiff from '~/image_diff/replaced_image_diff'; ...@@ -2,6 +2,7 @@ import ReplacedImageDiff from '~/image_diff/replaced_image_diff';
import ImageDiff from '~/image_diff/image_diff'; import ImageDiff from '~/image_diff/image_diff';
import { viewTypes } from '~/image_diff/view_types'; import { viewTypes } from '~/image_diff/view_types';
import imageDiffHelper from '~/image_diff/helpers/index'; import imageDiffHelper from '~/image_diff/helpers/index';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('ReplacedImageDiff', () => { describe('ReplacedImageDiff', () => {
let element; let element;
...@@ -12,17 +13,17 @@ describe('ReplacedImageDiff', () => { ...@@ -12,17 +13,17 @@ describe('ReplacedImageDiff', () => {
<div id="element"> <div id="element">
<div class="two-up"> <div class="two-up">
<div class="js-image-frame"> <div class="js-image-frame">
<img src="${gl.TEST_HOST}/image.png"> <img src="${TEST_HOST}/image.png">
</div> </div>
</div> </div>
<div class="swipe"> <div class="swipe">
<div class="js-image-frame"> <div class="js-image-frame">
<img src="${gl.TEST_HOST}/image.png"> <img src="${TEST_HOST}/image.png">
</div> </div>
</div> </div>
<div class="onion-skin"> <div class="onion-skin">
<div class="js-image-frame"> <div class="js-image-frame">
<img src="${gl.TEST_HOST}/image.png"> <img src="${TEST_HOST}/image.png">
</div> </div>
</div> </div>
<div class="view-modes-menu"> <div class="view-modes-menu">
......
...@@ -4,6 +4,7 @@ import Icon from '~/vue_shared/components/icon.vue'; ...@@ -4,6 +4,7 @@ import Icon from '~/vue_shared/components/icon.vue';
import UserAvatarImage from '~/vue_shared/components/user_avatar/user_avatar_image.vue'; import UserAvatarImage from '~/vue_shared/components/user_avatar/user_avatar_image.vue';
import Suggestion from '~/issuable_suggestions/components/item.vue'; import Suggestion from '~/issuable_suggestions/components/item.vue';
import mockData from '../mock_data'; import mockData from '../mock_data';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('Issuable suggestions suggestion component', () => { describe('Issuable suggestions suggestion component', () => {
let vm; let vm;
...@@ -34,7 +35,7 @@ describe('Issuable suggestions suggestion component', () => { ...@@ -34,7 +35,7 @@ describe('Issuable suggestions suggestion component', () => {
const link = vm.find(GlLink); const link = vm.find(GlLink);
expect(link.attributes('href')).toBe(`${gl.TEST_HOST}/test/issue/1`); expect(link.attributes('href')).toBe(`${TEST_HOST}/test/issue/1`);
}); });
it('renders IID', () => { it('renders IID', () => {
...@@ -100,7 +101,7 @@ describe('Issuable suggestions suggestion component', () => { ...@@ -100,7 +101,7 @@ describe('Issuable suggestions suggestion component', () => {
const image = vm.find(UserAvatarImage); const image = vm.find(UserAvatarImage);
expect(image.props('imgSrc')).toBe(`${gl.TEST_HOST}/avatar`); expect(image.props('imgSrc')).toBe(`${TEST_HOST}/avatar`);
}); });
}); });
......
import { TEST_HOST } from 'jest/helpers/test_constants';
function getDate(daysMinus) { function getDate(daysMinus) {
const today = new Date(); const today = new Date();
today.setDate(today.getDate() - daysMinus); today.setDate(today.getDate() - daysMinus);
...@@ -15,12 +17,12 @@ export default () => ({ ...@@ -15,12 +17,12 @@ export default () => ({
createdAt: getDate(3), createdAt: getDate(3),
updatedAt: getDate(2), updatedAt: getDate(2),
confidential: false, confidential: false,
webUrl: `${gl.TEST_HOST}/test/issue/1`, webUrl: `${TEST_HOST}/test/issue/1`,
title: 'Test issue', title: 'Test issue',
author: { author: {
avatarUrl: `${gl.TEST_HOST}/avatar`, avatarUrl: `${TEST_HOST}/avatar`,
name: 'Author Name', name: 'Author Name',
username: 'author.username', username: 'author.username',
webUrl: `${gl.TEST_HOST}/author`, webUrl: `${TEST_HOST}/author`,
}, },
}); });
...@@ -6,6 +6,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -6,6 +6,7 @@ import axios from '~/lib/utils/axios_utils';
import JobApp from '~/jobs/components/job_app.vue'; import JobApp from '~/jobs/components/job_app.vue';
import createStore from '~/jobs/store'; import createStore from '~/jobs/store';
import job from '../mock_data'; import job from '../mock_data';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('Job App', () => { describe('Job App', () => {
const localVue = createLocalVue(); const localVue = createLocalVue();
...@@ -18,8 +19,8 @@ describe('Job App', () => { ...@@ -18,8 +19,8 @@ describe('Job App', () => {
let mock; let mock;
const initSettings = { const initSettings = {
endpoint: `${gl.TEST_HOST}jobs/123.json`, endpoint: `${TEST_HOST}jobs/123.json`,
pagePath: `${gl.TEST_HOST}jobs/123`, pagePath: `${TEST_HOST}jobs/123`,
logState: logState:
'eyJvZmZzZXQiOjE3NDUxLCJuX29wZW5fdGFncyI6MCwiZmdfY29sb3IiOm51bGwsImJnX2NvbG9yIjpudWxsLCJzdHlsZV9tYXNrIjowfQ%3D%3D', 'eyJvZmZzZXQiOjE3NDUxLCJuX29wZW5fdGFncyI6MCwiZmdfY29sb3IiOm51bGwsImJnX2NvbG9yIjpudWxsLCJzdHlsZV9tYXNrIjowfQ%3D%3D',
}; };
......
...@@ -492,7 +492,7 @@ describe('Actions Notes Store', () => { ...@@ -492,7 +492,7 @@ describe('Actions Notes Store', () => {
it('commits ADD_NEW_NOTE and dispatches updateMergeRequestWidget', done => { it('commits ADD_NEW_NOTE and dispatches updateMergeRequestWidget', done => {
testAction( testAction(
actions.createNewNote, actions.createNewNote,
{ endpoint: `${gl.TEST_HOST}`, data: {} }, { endpoint: `${TEST_HOST}`, data: {} },
store.state, store.state,
[ [
{ {
...@@ -528,7 +528,7 @@ describe('Actions Notes Store', () => { ...@@ -528,7 +528,7 @@ describe('Actions Notes Store', () => {
it('does not commit ADD_NEW_NOTE or dispatch updateMergeRequestWidget', done => { it('does not commit ADD_NEW_NOTE or dispatch updateMergeRequestWidget', done => {
testAction( testAction(
actions.createNewNote, actions.createNewNote,
{ endpoint: `${gl.TEST_HOST}`, data: {} }, { endpoint: `${TEST_HOST}`, data: {} },
store.state, store.state,
[], [],
[], [],
...@@ -551,7 +551,7 @@ describe('Actions Notes Store', () => { ...@@ -551,7 +551,7 @@ describe('Actions Notes Store', () => {
it('commits UPDATE_NOTE and dispatches updateMergeRequestWidget', done => { it('commits UPDATE_NOTE and dispatches updateMergeRequestWidget', done => {
testAction( testAction(
actions.toggleResolveNote, actions.toggleResolveNote,
{ endpoint: `${gl.TEST_HOST}`, isResolved: true, discussion: false }, { endpoint: `${TEST_HOST}`, isResolved: true, discussion: false },
store.state, store.state,
[ [
{ {
...@@ -576,7 +576,7 @@ describe('Actions Notes Store', () => { ...@@ -576,7 +576,7 @@ describe('Actions Notes Store', () => {
it('commits UPDATE_DISCUSSION and dispatches updateMergeRequestWidget', done => { it('commits UPDATE_DISCUSSION and dispatches updateMergeRequestWidget', done => {
testAction( testAction(
actions.toggleResolveNote, actions.toggleResolveNote,
{ endpoint: `${gl.TEST_HOST}`, isResolved: true, discussion: true }, { endpoint: `${TEST_HOST}`, isResolved: true, discussion: true },
store.state, store.state,
[ [
{ {
......
...@@ -3,6 +3,7 @@ import MockAdapter from 'axios-mock-adapter'; ...@@ -3,6 +3,7 @@ import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import Pager from '~/pager'; import Pager from '~/pager';
import { removeParams } from '~/lib/utils/url_utility'; import { removeParams } from '~/lib/utils/url_utility';
import { TEST_HOST } from 'jest/helpers/test_constants';
jest.mock('~/lib/utils/url_utility', () => ({ jest.mock('~/lib/utils/url_utility', () => ({
removeParams: jest.fn().mockName('removeParams'), removeParams: jest.fn().mockName('removeParams'),
...@@ -32,7 +33,7 @@ describe('pager', () => { ...@@ -32,7 +33,7 @@ describe('pager', () => {
}); });
it('should use data-href attribute from list element', () => { it('should use data-href attribute from list element', () => {
const href = `${gl.TEST_HOST}/some_list.json`; const href = `${TEST_HOST}/some_list.json`;
setFixtures(`<div class="content_list" data-href="${href}"></div>`); setFixtures(`<div class="content_list" data-href="${href}"></div>`);
Pager.init(); Pager.init();
...@@ -40,7 +41,7 @@ describe('pager', () => { ...@@ -40,7 +41,7 @@ describe('pager', () => {
}); });
it('should use current url if data-href attribute not provided', () => { it('should use current url if data-href attribute not provided', () => {
const href = `${gl.TEST_HOST}/some_list`; const href = `${TEST_HOST}/some_list`;
removeParams.mockReturnValue(href); removeParams.mockReturnValue(href);
Pager.init(); Pager.init();
...@@ -56,7 +57,7 @@ describe('pager', () => { ...@@ -56,7 +57,7 @@ describe('pager', () => {
it('keeps extra query parameters from url', () => { it('keeps extra query parameters from url', () => {
window.history.replaceState({}, null, '?filter=test&offset=100'); window.history.replaceState({}, null, '?filter=test&offset=100');
const href = `${gl.TEST_HOST}/some_list?filter=test`; const href = `${TEST_HOST}/some_list?filter=test`;
removeParams.mockReturnValue(href); removeParams.mockReturnValue(href);
Pager.init(); Pager.init();
......
...@@ -3,6 +3,7 @@ import { redirectTo } from '~/lib/utils/url_utility'; ...@@ -3,6 +3,7 @@ import { redirectTo } from '~/lib/utils/url_utility';
import mountComponent from 'helpers/vue_mount_component_helper'; import mountComponent from 'helpers/vue_mount_component_helper';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import stopJobsModal from '~/pages/admin/jobs/index/components/stop_jobs_modal.vue'; import stopJobsModal from '~/pages/admin/jobs/index/components/stop_jobs_modal.vue';
import { TEST_HOST } from 'jest/helpers/test_constants';
jest.mock('~/lib/utils/url_utility', () => ({ jest.mock('~/lib/utils/url_utility', () => ({
...jest.requireActual('~/lib/utils/url_utility'), ...jest.requireActual('~/lib/utils/url_utility'),
...@@ -11,7 +12,7 @@ jest.mock('~/lib/utils/url_utility', () => ({ ...@@ -11,7 +12,7 @@ jest.mock('~/lib/utils/url_utility', () => ({
describe('stop_jobs_modal.vue', () => { describe('stop_jobs_modal.vue', () => {
const props = { const props = {
url: `${gl.TEST_HOST}/stop_jobs_modal.vue/stopAll`, url: `${TEST_HOST}/stop_jobs_modal.vue/stopAll`,
}; };
let vm; let vm;
...@@ -26,7 +27,7 @@ describe('stop_jobs_modal.vue', () => { ...@@ -26,7 +27,7 @@ describe('stop_jobs_modal.vue', () => {
describe('onSubmit', () => { describe('onSubmit', () => {
it('stops jobs and redirects to overview page', done => { it('stops jobs and redirects to overview page', done => {
const responseURL = `${gl.TEST_HOST}/stop_jobs_modal.vue/jobs`; const responseURL = `${TEST_HOST}/stop_jobs_modal.vue/jobs`;
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation(url => {
expect(url).toBe(props.url); expect(url).toBe(props.url);
return Promise.resolve({ return Promise.resolve({
......
...@@ -3,6 +3,7 @@ import mountComponent from 'helpers/vue_mount_component_helper'; ...@@ -3,6 +3,7 @@ import mountComponent from 'helpers/vue_mount_component_helper';
import promoteLabelModal from '~/pages/projects/labels/components/promote_label_modal.vue'; import promoteLabelModal from '~/pages/projects/labels/components/promote_label_modal.vue';
import eventHub from '~/pages/projects/labels/event_hub'; import eventHub from '~/pages/projects/labels/event_hub';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('Promote label modal', () => { describe('Promote label modal', () => {
let vm; let vm;
...@@ -11,7 +12,7 @@ describe('Promote label modal', () => { ...@@ -11,7 +12,7 @@ describe('Promote label modal', () => {
labelTitle: 'Documentation', labelTitle: 'Documentation',
labelColor: '#5cb85c', labelColor: '#5cb85c',
labelTextColor: '#ffffff', labelTextColor: '#ffffff',
url: `${gl.TEST_HOST}/dummy/promote/labels`, url: `${TEST_HOST}/dummy/promote/labels`,
groupName: 'group', groupName: 'group',
}; };
...@@ -51,7 +52,7 @@ describe('Promote label modal', () => { ...@@ -51,7 +52,7 @@ describe('Promote label modal', () => {
}); });
it('redirects when a label is promoted', done => { it('redirects when a label is promoted', done => {
const responseURL = `${gl.TEST_HOST}/dummy/endpoint`; const responseURL = `${TEST_HOST}/dummy/endpoint`;
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation(url => {
expect(url).toBe(labelMockData.url); expect(url).toBe(labelMockData.url);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
......
...@@ -4,6 +4,7 @@ import mountComponent from 'helpers/vue_mount_component_helper'; ...@@ -4,6 +4,7 @@ import mountComponent from 'helpers/vue_mount_component_helper';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import deleteMilestoneModal from '~/pages/milestones/shared/components/delete_milestone_modal.vue'; import deleteMilestoneModal from '~/pages/milestones/shared/components/delete_milestone_modal.vue';
import eventHub from '~/pages/milestones/shared/event_hub'; import eventHub from '~/pages/milestones/shared/event_hub';
import { TEST_HOST } from 'jest/helpers/test_constants';
jest.mock('~/lib/utils/url_utility', () => ({ jest.mock('~/lib/utils/url_utility', () => ({
...jest.requireActual('~/lib/utils/url_utility'), ...jest.requireActual('~/lib/utils/url_utility'),
...@@ -17,7 +18,7 @@ describe('delete_milestone_modal.vue', () => { ...@@ -17,7 +18,7 @@ describe('delete_milestone_modal.vue', () => {
mergeRequestCount: 2, mergeRequestCount: 2,
milestoneId: 3, milestoneId: 3,
milestoneTitle: 'my milestone title', milestoneTitle: 'my milestone title',
milestoneUrl: `${gl.TEST_HOST}/delete_milestone_modal.vue/milestone`, milestoneUrl: `${TEST_HOST}/delete_milestone_modal.vue/milestone`,
}; };
let vm; let vm;
...@@ -32,7 +33,7 @@ describe('delete_milestone_modal.vue', () => { ...@@ -32,7 +33,7 @@ describe('delete_milestone_modal.vue', () => {
}); });
it('deletes milestone and redirects to overview page', done => { it('deletes milestone and redirects to overview page', done => {
const responseURL = `${gl.TEST_HOST}/delete_milestone_modal.vue/milestoneOverview`; const responseURL = `${TEST_HOST}/delete_milestone_modal.vue/milestoneOverview`;
jest.spyOn(axios, 'delete').mockImplementation(url => { jest.spyOn(axios, 'delete').mockImplementation(url => {
expect(url).toBe(props.milestoneUrl); expect(url).toBe(props.milestoneUrl);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
......
...@@ -3,13 +3,14 @@ import mountComponent from 'helpers/vue_mount_component_helper'; ...@@ -3,13 +3,14 @@ import mountComponent from 'helpers/vue_mount_component_helper';
import promoteMilestoneModal from '~/pages/milestones/shared/components/promote_milestone_modal.vue'; import promoteMilestoneModal from '~/pages/milestones/shared/components/promote_milestone_modal.vue';
import eventHub from '~/pages/milestones/shared/event_hub'; import eventHub from '~/pages/milestones/shared/event_hub';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('Promote milestone modal', () => { describe('Promote milestone modal', () => {
let vm; let vm;
const Component = Vue.extend(promoteMilestoneModal); const Component = Vue.extend(promoteMilestoneModal);
const milestoneMockData = { const milestoneMockData = {
milestoneTitle: 'v1.0', milestoneTitle: 'v1.0',
url: `${gl.TEST_HOST}/dummy/promote/milestones`, url: `${TEST_HOST}/dummy/promote/milestones`,
groupName: 'group', groupName: 'group',
}; };
...@@ -46,7 +47,7 @@ describe('Promote milestone modal', () => { ...@@ -46,7 +47,7 @@ describe('Promote milestone modal', () => {
}); });
it('redirects when a milestone is promoted', done => { it('redirects when a milestone is promoted', done => {
const responseURL = `${gl.TEST_HOST}/dummy/endpoint`; const responseURL = `${TEST_HOST}/dummy/endpoint`;
jest.spyOn(axios, 'post').mockImplementation(url => { jest.spyOn(axios, 'post').mockImplementation(url => {
expect(url).toBe(milestoneMockData.url); expect(url).toBe(milestoneMockData.url);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith(
......
import $ from 'jquery'; import $ from 'jquery';
import projectNew from '~/projects/project_new'; import projectNew from '~/projects/project_new';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('New Project', () => { describe('New Project', () => {
let $projectImportUrl; let $projectImportUrl;
...@@ -33,7 +34,7 @@ describe('New Project', () => { ...@@ -33,7 +34,7 @@ describe('New Project', () => {
}); });
describe('deriveProjectPathFromUrl', () => { describe('deriveProjectPathFromUrl', () => {
const dummyImportUrl = `${gl.TEST_HOST}/dummy/import/url.git`; const dummyImportUrl = `${TEST_HOST}/dummy/import/url.git`;
beforeEach(() => { beforeEach(() => {
projectNew.bindEvents(); projectNew.bindEvents();
......
...@@ -3,6 +3,7 @@ import { mount } from '@vue/test-utils'; ...@@ -3,6 +3,7 @@ import { mount } from '@vue/test-utils';
import { formatDate } from '~/lib/utils/datetime_utility'; import { formatDate } from '~/lib/utils/datetime_utility';
import RelatedIssuableItem from '~/vue_shared/components/issue/related_issuable_item.vue'; import RelatedIssuableItem from '~/vue_shared/components/issue/related_issuable_item.vue';
import { defaultAssignees, defaultMilestone } from './related_issuable_mock_data'; import { defaultAssignees, defaultMilestone } from './related_issuable_mock_data';
import { TEST_HOST } from 'jest/helpers/test_constants';
describe('RelatedIssuableItem', () => { describe('RelatedIssuableItem', () => {
let wrapper; let wrapper;
...@@ -19,7 +20,7 @@ describe('RelatedIssuableItem', () => { ...@@ -19,7 +20,7 @@ describe('RelatedIssuableItem', () => {
idKey: 1, idKey: 1,
displayReference: 'gitlab-org/gitlab-test#1', displayReference: 'gitlab-org/gitlab-test#1',
pathIdSeparator: '#', pathIdSeparator: '#',
path: `${gl.TEST_HOST}/path`, path: `${TEST_HOST}/path`,
title: 'title', title: 'title',
confidential: true, confidential: true,
dueDate: '1990-12-31', dueDate: '1990-12-31',
......
import { TEST_HOST } from 'jest/helpers/test_constants';
export const defaultProps = { export const defaultProps = {
endpoint: '/foo/bar/issues/1/related_issues', endpoint: '/foo/bar/issues/1/related_issues',
currentNamespacePath: 'foo', currentNamespacePath: 'foo',
...@@ -83,8 +85,8 @@ export const defaultAssignees = [ ...@@ -83,8 +85,8 @@ export const defaultAssignees = [
name: 'Administrator', name: 'Administrator',
username: 'root', username: 'root',
state: 'active', state: 'active',
avatar_url: `${gl.TEST_HOST}`, avatar_url: `${TEST_HOST}`,
web_url: `${gl.TEST_HOST}/root`, web_url: `${TEST_HOST}/root`,
status_tooltip_html: null, status_tooltip_html: null,
path: '/root', path: '/root',
}, },
...@@ -93,8 +95,8 @@ export const defaultAssignees = [ ...@@ -93,8 +95,8 @@ export const defaultAssignees = [
name: 'Brooks Beatty', name: 'Brooks Beatty',
username: 'brynn_champlin', username: 'brynn_champlin',
state: 'active', state: 'active',
avatar_url: `${gl.TEST_HOST}`, avatar_url: `${TEST_HOST}`,
web_url: `${gl.TEST_HOST}/brynn_champlin`, web_url: `${TEST_HOST}/brynn_champlin`,
status_tooltip_html: null, status_tooltip_html: null,
path: '/brynn_champlin', path: '/brynn_champlin',
}, },
...@@ -103,8 +105,8 @@ export const defaultAssignees = [ ...@@ -103,8 +105,8 @@ export const defaultAssignees = [
name: 'Bryce Turcotte', name: 'Bryce Turcotte',
username: 'melynda', username: 'melynda',
state: 'active', state: 'active',
avatar_url: `${gl.TEST_HOST}`, avatar_url: `${TEST_HOST}`,
web_url: `${gl.TEST_HOST}/melynda`, web_url: `${TEST_HOST}/melynda`,
status_tooltip_html: null, status_tooltip_html: null,
path: '/melynda', path: '/melynda',
}, },
...@@ -113,8 +115,8 @@ export const defaultAssignees = [ ...@@ -113,8 +115,8 @@ export const defaultAssignees = [
name: 'Conchita Eichmann', name: 'Conchita Eichmann',
username: 'juliana_gulgowski', username: 'juliana_gulgowski',
state: 'active', state: 'active',
avatar_url: `${gl.TEST_HOST}`, avatar_url: `${TEST_HOST}`,
web_url: `${gl.TEST_HOST}/juliana_gulgowski`, web_url: `${TEST_HOST}/juliana_gulgowski`,
status_tooltip_html: null, status_tooltip_html: null,
path: '/juliana_gulgowski', path: '/juliana_gulgowski',
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment