Commit fbc0f631 authored by winniehell's avatar winniehell

Use global Vue instance in Jest (admin)

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