diff options
Diffstat (limited to 'spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js')
-rw-r--r-- | spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js b/spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js index 266f953c3e0..465e6dc73e2 100644 --- a/spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js +++ b/spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js @@ -1,6 +1,6 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import VueApollo from 'vue-apollo'; -import { nextTick } from 'vue'; +import Vue, { nextTick } from 'vue'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import { GlCard, GlLoadingIcon } from 'jest/packages_and_registries/shared/stubs'; @@ -14,8 +14,6 @@ import expirationPolicyQuery from '~/packages_and_registries/settings/project/gr import Tracking from '~/tracking'; import { expirationPolicyPayload, expirationPolicyMutationPayload } from '../mock_data'; -const localVue = createLocalVue(); - describe('Settings Form', () => { let wrapper; let fakeApollo; @@ -59,7 +57,6 @@ describe('Settings Form', () => { data, config, provide = defaultProvidedValues, - mocks, } = {}) => { wrapper = shallowMount(component, { stubs: { @@ -77,7 +74,6 @@ describe('Settings Form', () => { $toast: { show: jest.fn(), }, - ...mocks, }, ...config, }); @@ -88,7 +84,7 @@ describe('Settings Form', () => { mutationResolver, queryPayload = expirationPolicyPayload(), } = {}) => { - localVue.use(VueApollo); + Vue.use(VueApollo); const requestHandlers = [ [updateContainerExpirationPolicyMutation, mutationResolver], @@ -120,7 +116,6 @@ describe('Settings Form', () => { value, }, config: { - localVue, apolloProvider: fakeApollo, }, }); @@ -356,8 +351,8 @@ describe('Settings Form', () => { }); it('parses the error messages', async () => { - const mutate = jest.fn().mockRejectedValue({ - graphQLErrors: [ + const mutate = jest.fn().mockResolvedValue({ + errors: [ { extensions: { problems: [{ path: ['nameRegexKeep'], message: 'baz' }], @@ -365,7 +360,9 @@ describe('Settings Form', () => { }, ], }); - mountComponent({ mocks: { $apollo: { mutate } } }); + mountComponentWithApollo({ + mutationResolver: mutate, + }); await submitForm(); |