Commit f00c2e89 authored by Phil Hughes's avatar Phil Hughes

Merge branch...

Merge branch '121748-clean-unnecessary-localvue-in-various-standalone-specs-on-spec-frontend' into 'master'

Clean unnecessary 'localVue' in various specs on 'spec/frontend'

See merge request gitlab-org/gitlab!22464
parents 8e6d4aad 0461c4ef
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import ProjectFormGroup from '~/confidential_merge_request/components/project_form_group.vue'; import ProjectFormGroup from '~/confidential_merge_request/components/project_form_group.vue';
const localVue = createLocalVue();
const mockData = [ const mockData = [
{ {
id: 1, id: 1,
...@@ -30,7 +29,6 @@ function factory(projects = mockData) { ...@@ -30,7 +29,6 @@ function factory(projects = mockData) {
mock.onGet(/api\/(.*)\/projects\/gitlab-org%2Fgitlab-ce\/forks/).reply(200, projects); mock.onGet(/api\/(.*)\/projects\/gitlab-org%2Fgitlab-ce\/forks/).reply(200, projects);
vm = shallowMount(ProjectFormGroup, { vm = shallowMount(ProjectFormGroup, {
localVue,
propsData: { propsData: {
namespacePath: 'gitlab-org', namespacePath: 'gitlab-org',
projectPath: 'gitlab-org/gitlab-ce', projectPath: 'gitlab-org/gitlab-ce',
...@@ -49,7 +47,7 @@ describe('Confidential merge request project form group component', () => { ...@@ -49,7 +47,7 @@ describe('Confidential merge request project form group component', () => {
it('renders fork dropdown', () => { it('renders fork dropdown', () => {
factory(); factory();
return localVue.nextTick(() => { return vm.vm.$nextTick(() => {
expect(vm.element).toMatchSnapshot(); expect(vm.element).toMatchSnapshot();
}); });
}); });
...@@ -57,7 +55,7 @@ describe('Confidential merge request project form group component', () => { ...@@ -57,7 +55,7 @@ describe('Confidential merge request project form group component', () => {
it('sets selected project as first fork', () => { it('sets selected project as first fork', () => {
factory(); factory();
return localVue.nextTick(() => { return vm.vm.$nextTick(() => {
expect(vm.vm.selectedProject).toEqual({ expect(vm.vm.selectedProject).toEqual({
id: 1, id: 1,
name: 'root / gitlab-ce', name: 'root / gitlab-ce',
...@@ -70,7 +68,7 @@ describe('Confidential merge request project form group component', () => { ...@@ -70,7 +68,7 @@ describe('Confidential merge request project form group component', () => {
it('renders empty state when response is empty', () => { it('renders empty state when response is empty', () => {
factory([]); factory([]);
return localVue.nextTick(() => { return vm.vm.$nextTick(() => {
expect(vm.element).toMatchSnapshot(); expect(vm.element).toMatchSnapshot();
}); });
}); });
......
import Vue from 'vue'; import Vue from 'vue';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import { createStore } from '~/contributors/stores'; import { createStore } from '~/contributors/stores';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import ContributorsCharts from '~/contributors/components/contributors.vue'; import ContributorsCharts from '~/contributors/components/contributors.vue';
const localVue = createLocalVue();
let wrapper; let wrapper;
let mock; let mock;
let store; let store;
...@@ -52,7 +51,7 @@ describe('Contributors charts', () => { ...@@ -52,7 +51,7 @@ describe('Contributors charts', () => {
it('should display loader whiled loading data', () => { it('should display loader whiled loading data', () => {
wrapper.vm.$store.state.loading = true; wrapper.vm.$store.state.loading = true;
return localVue.nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.find('.contributors-loader').exists()).toBe(true); expect(wrapper.find('.contributors-loader').exists()).toBe(true);
}); });
}); });
...@@ -60,7 +59,7 @@ describe('Contributors charts', () => { ...@@ -60,7 +59,7 @@ describe('Contributors charts', () => {
it('should render charts when loading completed and there is chart data', () => { it('should render charts when loading completed and there is chart data', () => {
wrapper.vm.$store.state.loading = false; wrapper.vm.$store.state.loading = false;
wrapper.vm.$store.state.chartData = chartData; wrapper.vm.$store.state.chartData = chartData;
return localVue.nextTick(() => { return wrapper.vm.$nextTick(() => {
expect(wrapper.find('.contributors-loader').exists()).toBe(false); expect(wrapper.find('.contributors-loader').exists()).toBe(false);
expect(wrapper.find('.contributors-charts').exists()).toBe(true); expect(wrapper.find('.contributors-charts').exists()).toBe(true);
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
......
...@@ -25,7 +25,7 @@ describe('ide/components/ide_status_list', () => { ...@@ -25,7 +25,7 @@ describe('ide/components/ide_status_list', () => {
}, },
}); });
wrapper = shallowMount(localVue.extend(IdeStatusList), { wrapper = shallowMount(IdeStatusList, {
localVue, localVue,
sync: false, sync: false,
store, store,
......
import axios from 'axios'; import axios from 'axios';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlEmptyState, GlPagination, GlSkeletonLoading } from '@gitlab/ui'; import { GlEmptyState, GlPagination, GlSkeletonLoading } from '@gitlab/ui';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
...@@ -18,8 +18,6 @@ const TEST_ENDPOINT = '/issues'; ...@@ -18,8 +18,6 @@ const TEST_ENDPOINT = '/issues';
const TEST_CREATE_ISSUES_PATH = '/createIssue'; const TEST_CREATE_ISSUES_PATH = '/createIssue';
const TEST_EMPTY_SVG_PATH = '/emptySvg'; const TEST_EMPTY_SVG_PATH = '/emptySvg';
const localVue = createLocalVue();
const MOCK_ISSUES = Array(PAGE_SIZE_MANUAL) const MOCK_ISSUES = Array(PAGE_SIZE_MANUAL)
.fill(0) .fill(0)
.map((_, i) => ({ .map((_, i) => ({
...@@ -40,14 +38,13 @@ describe('Issuables list component', () => { ...@@ -40,14 +38,13 @@ describe('Issuables list component', () => {
}; };
const factory = (props = { sortKey: 'priority' }) => { const factory = (props = { sortKey: 'priority' }) => {
wrapper = shallowMount(localVue.extend(IssuablesListApp), { wrapper = shallowMount(IssuablesListApp, {
propsData: { propsData: {
endpoint: TEST_ENDPOINT, endpoint: TEST_ENDPOINT,
createIssuePath: TEST_CREATE_ISSUES_PATH, createIssuePath: TEST_CREATE_ISSUES_PATH,
emptySvgPath: TEST_EMPTY_SVG_PATH, emptySvgPath: TEST_EMPTY_SVG_PATH,
...props, ...props,
}, },
localVue,
sync: false, sync: false,
attachToDocument: true, attachToDocument: true,
}); });
......
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { GlLink } from '@gitlab/ui'; import { GlLink } from '@gitlab/ui';
import PinnedLinks from '~/issue_show/components/pinned_links.vue'; import PinnedLinks from '~/issue_show/components/pinned_links.vue';
const localVue = createLocalVue();
const plainZoomUrl = 'https://zoom.us/j/123456789'; const plainZoomUrl = 'https://zoom.us/j/123456789';
describe('PinnedLinks', () => { describe('PinnedLinks', () => {
...@@ -19,8 +17,7 @@ describe('PinnedLinks', () => { ...@@ -19,8 +17,7 @@ describe('PinnedLinks', () => {
}; };
const createComponent = props => { const createComponent = props => {
wrapper = shallowMount(localVue.extend(PinnedLinks), { wrapper = shallowMount(PinnedLinks, {
localVue,
sync: false, sync: false,
propsData: { propsData: {
zoomMeetingUrl: null, zoomMeetingUrl: null,
......
import { mount, shallowMount, createLocalVue } from '@vue/test-utils'; import { mount, shallowMount } from '@vue/test-utils';
import { GlButton, GlLink, GlFormGroup, GlFormInput } from '@gitlab/ui'; import { GlButton, GlLink, GlFormGroup, GlFormInput } from '@gitlab/ui';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import ExternalDashboard from '~/operation_settings/components/external_dashboard.vue'; import ExternalDashboard from '~/operation_settings/components/external_dashboard.vue';
...@@ -15,12 +15,10 @@ describe('operation settings external dashboard component', () => { ...@@ -15,12 +15,10 @@ describe('operation settings external dashboard component', () => {
const operationsSettingsEndpoint = `${TEST_HOST}/mock/ops/settings/endpoint`; const operationsSettingsEndpoint = `${TEST_HOST}/mock/ops/settings/endpoint`;
const externalDashboardUrl = `http://mock-external-domain.com/external/dashboard/url`; const externalDashboardUrl = `http://mock-external-domain.com/external/dashboard/url`;
const externalDashboardHelpPagePath = `${TEST_HOST}/help/page/path`; const externalDashboardHelpPagePath = `${TEST_HOST}/help/page/path`;
const localVue = createLocalVue();
const mountComponent = (shallow = true) => { const mountComponent = (shallow = true) => {
const config = [ const config = [
ExternalDashboard, ExternalDashboard,
{ {
localVue,
store: store({ store: store({
operationsSettingsEndpoint, operationsSettingsEndpoint,
externalDashboardUrl, externalDashboardUrl,
......
import { mount, createLocalVue } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
import { GlLink } from '@gitlab/ui'; import { GlLink } from '@gitlab/ui';
import { truncateSha } from '~/lib/utils/text_utility'; import { truncateSha } from '~/lib/utils/text_utility';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
...@@ -10,10 +10,7 @@ describe('Evidence Block', () => { ...@@ -10,10 +10,7 @@ describe('Evidence Block', () => {
let wrapper; let wrapper;
const factory = (options = {}) => { const factory = (options = {}) => {
const localVue = createLocalVue(); wrapper = mount(EvidenceBlock, {
wrapper = mount(localVue.extend(EvidenceBlock), {
localVue,
...options, ...options,
}); });
}; };
......
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import environmentRowComponent from '~/serverless/components/environment_row.vue'; import environmentRowComponent from '~/serverless/components/environment_row.vue';
import { mockServerlessFunctions, mockServerlessFunctionsDiffEnv } from '../mock_data'; import { mockServerlessFunctions, mockServerlessFunctionsDiffEnv } from '../mock_data';
import { translate } from '~/serverless/utils'; import { translate } from '~/serverless/utils';
const createComponent = (localVue, env, envName) => const createComponent = (env, envName) =>
shallowMount(environmentRowComponent, { localVue, propsData: { env, envName }, sync: false }).vm; shallowMount(environmentRowComponent, { propsData: { env, envName }, sync: false }).vm;
describe('environment row component', () => { describe('environment row component', () => {
describe('default global cluster case', () => { describe('default global cluster case', () => {
let localVue;
let vm; let vm;
beforeEach(() => { beforeEach(() => {
localVue = createLocalVue(); vm = createComponent(translate(mockServerlessFunctions.functions)['*'], '*');
vm = createComponent(localVue, translate(mockServerlessFunctions.functions)['*'], '*');
}); });
afterEach(() => vm.$destroy()); afterEach(() => vm.$destroy());
...@@ -44,15 +42,9 @@ describe('environment row component', () => { ...@@ -44,15 +42,9 @@ describe('environment row component', () => {
describe('default named cluster case', () => { describe('default named cluster case', () => {
let vm; let vm;
let localVue;
beforeEach(() => { beforeEach(() => {
localVue = createLocalVue(); vm = createComponent(translate(mockServerlessFunctionsDiffEnv.functions).test, 'test');
vm = createComponent(
localVue,
translate(mockServerlessFunctionsDiffEnv.functions).test,
'test',
);
}); });
afterEach(() => vm.$destroy()); afterEach(() => vm.$destroy());
......
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