Commit b8ab9a2b authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'winniehell-remove-local-vue-admin' into 'master'

Use global Vue instance in Jest (admin)

See merge request gitlab-org/gitlab!76403
parents ec75980b fbc0f631
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import SubscriptionManagementApp from 'ee/admin/subscriptions/show/components/app.vue'; import SubscriptionManagementApp from 'ee/admin/subscriptions/show/components/app.vue';
import SubscriptionActivationCard from 'ee/admin/subscriptions/show/components/subscription_activation_card.vue'; import SubscriptionActivationCard from 'ee/admin/subscriptions/show/components/subscription_activation_card.vue';
...@@ -19,8 +20,7 @@ import createMockApollo from 'helpers/mock_apollo_helper'; ...@@ -19,8 +20,7 @@ import createMockApollo from 'helpers/mock_apollo_helper';
import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import { license, subscriptionHistory } from '../mock_data'; import { license, subscriptionHistory } from '../mock_data';
const localVue = createLocalVue(); Vue.use(VueApollo);
localVue.use(VueApollo);
describe('SubscriptionManagementApp', () => { describe('SubscriptionManagementApp', () => {
// March 16th, 2020 // March 16th, 2020
...@@ -40,7 +40,7 @@ describe('SubscriptionManagementApp', () => { ...@@ -40,7 +40,7 @@ describe('SubscriptionManagementApp', () => {
let currentSubscriptionResolver; let currentSubscriptionResolver;
let subscriptionHistoryResolver; let subscriptionHistoryResolver;
const createMockApolloProvider = ([subscriptionResolver, historyResolver]) => { const createMockApolloProvider = ([subscriptionResolver, historyResolver]) => {
localVue.use(VueApollo); Vue.use(VueApollo);
return createMockApollo([ return createMockApollo([
[subscriptionQueries.query, subscriptionResolver], [subscriptionQueries.query, subscriptionResolver],
[subscriptionHistoryQueries.query, historyResolver], [subscriptionHistoryQueries.query, historyResolver],
...@@ -50,7 +50,6 @@ describe('SubscriptionManagementApp', () => { ...@@ -50,7 +50,6 @@ describe('SubscriptionManagementApp', () => {
const createComponent = (props = {}, resolverMock) => { const createComponent = (props = {}, resolverMock) => {
wrapper = extendedWrapper( wrapper = extendedWrapper(
shallowMount(SubscriptionManagementApp, { shallowMount(SubscriptionManagementApp, {
localVue,
apolloProvider: createMockApolloProvider(resolverMock), apolloProvider: createMockApolloProvider(resolverMock),
propsData: { propsData: {
licenseUsageFilePath: 'about:blank', licenseUsageFilePath: 'about:blank',
......
import { GlForm, GlFormCheckbox, GlFormInput, GlLink, GlSprintf } from '@gitlab/ui'; import { GlForm, GlFormCheckbox, GlFormInput, GlLink, GlSprintf } from '@gitlab/ui';
import { createLocalVue, mount, shallowMount } from '@vue/test-utils'; import { mount, shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import SubscriptionActivationForm from 'ee/admin/subscriptions/show/components/subscription_activation_form.vue'; import SubscriptionActivationForm from 'ee/admin/subscriptions/show/components/subscription_activation_form.vue';
import { import {
...@@ -22,14 +23,12 @@ import { ...@@ -22,14 +23,12 @@ import {
fakeActivationCode, fakeActivationCode,
} from '../mock_data'; } from '../mock_data';
const localVue = createLocalVue(); Vue.use(VueApollo);
localVue.use(VueApollo);
describe('SubscriptionActivationForm', () => { describe('SubscriptionActivationForm', () => {
let wrapper; let wrapper;
const createMockApolloProvider = (resolverMock) => { const createMockApolloProvider = (resolverMock) => {
localVue.use(VueApollo);
return createMockApollo([[subscriptionQueries.mutation, resolverMock]]); return createMockApollo([[subscriptionQueries.mutation, resolverMock]]);
}; };
...@@ -55,7 +54,6 @@ describe('SubscriptionActivationForm', () => { ...@@ -55,7 +54,6 @@ describe('SubscriptionActivationForm', () => {
} = {}) => { } = {}) => {
wrapper = extendedWrapper( wrapper = extendedWrapper(
mountMethod(SubscriptionActivationForm, { mountMethod(SubscriptionActivationForm, {
localVue,
apolloProvider: createMockApolloProvider(mutationMock), apolloProvider: createMockApolloProvider(mutationMock),
propsData: { propsData: {
...props, ...props,
......
import { GlLoadingIcon } from '@gitlab/ui'; import { GlLoadingIcon } from '@gitlab/ui';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import AxiosMockAdapter from 'axios-mock-adapter'; import AxiosMockAdapter from 'axios-mock-adapter';
import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import StatisticsPanelApp from '~/admin/statistics_panel/components/app.vue'; import StatisticsPanelApp from '~/admin/statistics_panel/components/app.vue';
import statisticsLabels from '~/admin/statistics_panel/constants'; import statisticsLabels from '~/admin/statistics_panel/constants';
...@@ -9,8 +10,7 @@ import axios from '~/lib/utils/axios_utils'; ...@@ -9,8 +10,7 @@ import axios from '~/lib/utils/axios_utils';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import mockStatistics from '../mock_data'; import mockStatistics from '../mock_data';
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
describe('Admin statistics app', () => { describe('Admin statistics app', () => {
let wrapper; let wrapper;
...@@ -19,7 +19,6 @@ describe('Admin statistics app', () => { ...@@ -19,7 +19,6 @@ describe('Admin statistics app', () => {
const createComponent = () => { const createComponent = () => {
wrapper = shallowMount(StatisticsPanelApp, { wrapper = shallowMount(StatisticsPanelApp, {
localVue,
store, store,
}); });
}; };
......
import { GlTable, GlSkeletonLoader } from '@gitlab/ui'; import { GlTable, GlSkeletonLoader } from '@gitlab/ui';
import { createLocalVue } from '@vue/test-utils'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
...@@ -16,8 +16,7 @@ import { users, paths, createGroupCountResponse } from '../mock_data'; ...@@ -16,8 +16,7 @@ import { users, paths, createGroupCountResponse } from '../mock_data';
jest.mock('~/flash'); jest.mock('~/flash');
const localVue = createLocalVue(); Vue.use(VueApollo);
localVue.use(VueApollo);
describe('AdminUsersTable component', () => { describe('AdminUsersTable component', () => {
let wrapper; let wrapper;
...@@ -48,7 +47,6 @@ describe('AdminUsersTable component', () => { ...@@ -48,7 +47,6 @@ describe('AdminUsersTable component', () => {
const initComponent = (props = {}, resolverMock = fetchGroupCountsResponse) => { const initComponent = (props = {}, resolverMock = fetchGroupCountsResponse) => {
wrapper = mountExtended(AdminUsersTable, { wrapper = mountExtended(AdminUsersTable, {
localVue,
apolloProvider: createMockApolloProvider(resolverMock), apolloProvider: createMockApolloProvider(resolverMock),
propsData: { propsData: {
users, users,
......
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