diff options
Diffstat (limited to 'spec/frontend/feature_flags/components/new_feature_flag_spec.js')
-rw-r--r-- | spec/frontend/feature_flags/components/new_feature_flag_spec.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/spec/frontend/feature_flags/components/new_feature_flag_spec.js b/spec/frontend/feature_flags/components/new_feature_flag_spec.js index fe98b6421d4..9c1657bc0d2 100644 --- a/spec/frontend/feature_flags/components/new_feature_flag_spec.js +++ b/spec/frontend/feature_flags/components/new_feature_flag_spec.js @@ -1,5 +1,6 @@ import { GlAlert } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import { TEST_HOST } from 'spec/test_constants'; import Form from '~/feature_flags/components/form.vue'; @@ -10,8 +11,7 @@ import { allUsersStrategy } from '../mock_data'; const userCalloutId = 'feature_flags_new_version'; const userCalloutsPath = `${TEST_HOST}/user_callouts`; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('New feature flag form', () => { let wrapper; @@ -27,7 +27,6 @@ describe('New feature flag form', () => { wrapper = null; } wrapper = shallowMount(NewFeatureFlag, { - localVue, store, provide: { showUserCallout: true, @@ -52,13 +51,12 @@ describe('New feature flag form', () => { }); describe('with error', () => { - it('should render the error', () => { + it('should render the error', async () => { store.dispatch('receiveCreateFeatureFlagError', { message: ['The name is required'] }); - return wrapper.vm.$nextTick(() => { - const warningGlAlert = findWarningGlAlert(); - expect(warningGlAlert.at(0).exists()).toBe(true); - expect(warningGlAlert.at(0).text()).toContain('The name is required'); - }); + await nextTick(); + const warningGlAlert = findWarningGlAlert(); + expect(warningGlAlert.at(0).exists()).toBe(true); + expect(warningGlAlert.at(0).text()).toContain('The name is required'); }); }); |