Commit 2d174887 authored by Kushal Pandya's avatar Kushal Pandya

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

Use global Vue instance in Jest (approvals)

See merge request gitlab-org/gitlab!76486
parents 8c967a14 e287f845
import { GlButton, GlForm, GlLoadingIcon, GlLink } from '@gitlab/ui';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import ApprovalSettings from 'ee/approvals/components/approval_settings.vue';
......@@ -16,8 +17,7 @@ import waitForPromises from 'helpers/wait_for_promises';
import { sprintf } from '~/locale';
import { createGroupApprovalsPayload, createGroupApprovalsState } from '../mocks';
const localVue = createLocalVue();
localVue.use(Vuex);
Vue.use(Vuex);
describe('ApprovalSettings', () => {
let wrapper;
......@@ -44,7 +44,6 @@ describe('ApprovalSettings', () => {
const createWrapper = (props = {}) => {
wrapper = extendedWrapper(
shallowMount(ApprovalSettings, {
localVue,
store,
propsData: {
approvalSettingsPath,
......
import { createLocalVue, shallowMount } from '@vue/test-utils';
import { shallowMount } from '@vue/test-utils';
import $ from 'jquery';
import 'select2/select2';
import Api from 'ee/api';
......@@ -24,8 +24,6 @@ const TEST_USERS = [
{ id: 3, name: 'Sit', username: 'sit', avatar_url: TEST_USER_AVATAR },
];
const localVue = createLocalVue();
const waitForEvent = ($input, event) => new Promise((resolve) => $input.one(event, resolve));
const parseAvatar = (element) =>
element.classList.contains('identicon') ? null : element.getAttribute('src');
......@@ -62,7 +60,6 @@ describe('Approvals ApproversSelect', () => {
wrapper = await shallowMount(ApproversSelect, {
...options,
propsData,
localVue,
attachTo: document.body,
});
......
import { GlSprintf, GlLink } from '@gitlab/ui';
import { createLocalVue, shallowMount } from '@vue/test-utils';
import { shallowMount } from '@vue/test-utils';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import Vue from 'vue';
import Vuex from 'vuex';
import ApprovalSettings from 'ee/approvals/components/approval_settings.vue';
......@@ -13,8 +14,7 @@ import approvalSettingsModule from 'ee/approvals/stores/modules/approval_setting
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import SettingsBlock from '~/vue_shared/components/settings/settings_block.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
Vue.use(Vuex);
describe('EE Approvals Group Settings App', () => {
let wrapper;
......@@ -27,7 +27,6 @@ describe('EE Approvals Group Settings App', () => {
const createWrapper = () => {
wrapper = extendedWrapper(
shallowMount(GroupSettingsApp, {
localVue,
store: new Vuex.Store(store),
propsData: {
defaultExpanded,
......
import { GlIcon } from '@gitlab/ui';
import { mount, createLocalVue } from '@vue/test-utils';
import { mount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import LicenseComplianceApprovals from 'ee/approvals/components/license_compliance/index.vue';
import approvalsLicenceComplianceModule, {
......@@ -8,8 +9,7 @@ import approvalsLicenceComplianceModule, {
} from 'ee/approvals/stores/modules/license_compliance';
import modalModule from '~/vuex_shared/modules/modal';
const localVue = createLocalVue();
localVue.use(Vuex);
Vue.use(Vuex);
const TEST_APPROVALS_DOCUMENTATION_PATH = 'http://foo.bar';
const TEST_LOCKED_APPROVALS_RULE_NAME = 'License-Check';
......@@ -35,7 +35,6 @@ describe('EE Approvals LicenseCompliance', () => {
const createWrapper = () => {
wrapper = mount(LicenseComplianceApprovals, {
localVue,
store: new Vuex.Store(store),
stubs: {
'rule-form': true,
......
import { GlSprintf, GlModal } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import LicenseComplianceModal from 'ee/approvals/components/license_compliance/modal.vue';
import { APPROVALS_MODAL } from 'ee/approvals/stores/modules/license_compliance';
import GlModalVuex from '~/vue_shared/components/gl_modal_vuex.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
Vue.use(Vuex);
describe('EE Approvals LicenseCompliance Modal', () => {
let wrapper;
......@@ -52,7 +52,6 @@ describe('EE Approvals LicenseCompliance Modal', () => {
const createWrapper = () => {
wrapper = shallowMount(LicenseComplianceModal, {
localVue,
store,
stubs: {
GlModalVuex,
......
import { GlSprintf } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import ModalRuleRemove from 'ee/approvals/components/modal_rule_remove.vue';
import { stubComponent } from 'helpers/stub_component';
......@@ -19,8 +20,7 @@ const SINGLE_APPROVER = {
approvers: [{ id: 1 }],
};
const localVue = createLocalVue();
localVue.use(Vuex);
Vue.use(Vuex);
describe('Approvals ModalRuleRemove', () => {
let wrapper;
......@@ -47,7 +47,6 @@ describe('Approvals ModalRuleRemove', () => {
wrapper = shallowMount(ModalRuleRemove, {
...options,
localVue,
store,
propsData,
stubs: {
......
import { mount, createLocalVue } from '@vue/test-utils';
import { mount } from '@vue/test-utils';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import Vue from 'vue';
import Vuex from 'vuex';
import MREditApp from 'ee/approvals/components/mr_edit/app.vue';
import MRRules from 'ee/approvals/components/mr_edit/mr_rules.vue';
......@@ -8,8 +9,7 @@ import MRRulesHiddenInputs from 'ee/approvals/components/mr_edit/mr_rules_hidden
import { createStoreOptions } from 'ee/approvals/stores';
import MREditModule from 'ee/approvals/stores/modules/mr_edit';
const localVue = createLocalVue();
localVue.use(Vuex);
Vue.use(Vuex);
describe('EE Approvals MREditApp', () => {
let wrapper;
......@@ -18,7 +18,6 @@ describe('EE Approvals MREditApp', () => {
const factory = (mrCollapsedApprovalRules = false) => {
wrapper = mount(MREditApp, {
localVue,
store: new Vuex.Store(store),
provide: {
glFeatures: {
......
import { shallowMount, createLocalVue } from '@vue/test-utils';
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import RuleInput from 'ee/approvals/components/mr_edit/rule_input.vue';
import { createStoreOptions } from 'ee/approvals/stores';
import MREditModule from 'ee/approvals/stores/modules/mr_edit';
const localVue = createLocalVue();
localVue.use(Vuex);
Vue.use(Vuex);
describe('Rule Input', () => {
let wrapper;
......@@ -20,7 +20,6 @@ describe('Rule Input', () => {
},
...props,
},
localVue,
store: new Vuex.Store(store),
});
};
......
import { GlLink, GlPopover, GlIcon } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import RuleName from 'ee/approvals/components/rule_name.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
Vue.use(Vuex);
describe('RuleName component', () => {
let wrapper;
const createWrapper = (props = {}) => {
wrapper = shallowMount(RuleName, {
localVue,
propsData: {
...props,
},
......
import { GlSprintf, GlButton } from '@gitlab/ui';
import { mount, createLocalVue } from '@vue/test-utils';
import { mount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import UnconfiguredSecurityRule from 'ee/approvals/components/security_configuration/unconfigured_security_rule.vue';
import {
......@@ -8,8 +9,7 @@ import {
COVERAGE_CHECK_NAME,
} from 'ee/approvals/constants';
const localVue = createLocalVue();
localVue.use(Vuex);
Vue.use(Vuex);
describe('UnconfiguredSecurityRule component', () => {
let wrapper;
......@@ -38,7 +38,6 @@ describe('UnconfiguredSecurityRule component', () => {
const createWrapper = (props = {}, options = {}) => {
wrapper = mount(UnconfiguredSecurityRule, {
localVue,
propsData: {
...props,
},
......
import { GlDeprecatedSkeletonLoading as GlSkeletonLoading } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils';
import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex';
import UnconfiguredSecurityRule from 'ee/approvals/components/security_configuration/unconfigured_security_rule.vue';
import UnconfiguredSecurityRules from 'ee/approvals/components/security_configuration/unconfigured_security_rules.vue';
import { createStoreOptions } from 'ee/approvals/stores';
import projectSettingsModule from 'ee/approvals/stores/modules/project_settings';
const localVue = createLocalVue();
localVue.use(Vuex);
Vue.use(Vuex);
describe('UnconfiguredSecurityRules component', () => {
let wrapper;
......@@ -17,7 +17,6 @@ describe('UnconfiguredSecurityRules component', () => {
const createWrapper = (props = {}) => {
wrapper = shallowMount(UnconfiguredSecurityRules, {
localVue,
store,
propsData: {
...props,
......
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