diff options
Diffstat (limited to 'spec/frontend/deploy_keys/components/action_btn_spec.js')
-rw-r--r-- | spec/frontend/deploy_keys/components/action_btn_spec.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/spec/frontend/deploy_keys/components/action_btn_spec.js b/spec/frontend/deploy_keys/components/action_btn_spec.js index 6ac68061518..c4c7a9aea2d 100644 --- a/spec/frontend/deploy_keys/components/action_btn_spec.js +++ b/spec/frontend/deploy_keys/components/action_btn_spec.js @@ -1,5 +1,6 @@ import { GlButton } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import data from 'test_fixtures/deploy_keys/keys.json'; import actionBtn from '~/deploy_keys/components/action_btn.vue'; import eventHub from '~/deploy_keys/eventhub'; @@ -37,21 +38,19 @@ describe('Deploy keys action btn', () => { }); }); - it('sends eventHub event with btn type', () => { + it('sends eventHub event with btn type', async () => { jest.spyOn(eventHub, '$emit').mockImplementation(() => {}); findButton().vm.$emit('click'); - return wrapper.vm.$nextTick().then(() => { - expect(eventHub.$emit).toHaveBeenCalledWith('enable.key', deployKey, expect.anything()); - }); + await nextTick(); + expect(eventHub.$emit).toHaveBeenCalledWith('enable.key', deployKey, expect.anything()); }); - it('shows loading spinner after click', () => { + it('shows loading spinner after click', async () => { findButton().vm.$emit('click'); - return wrapper.vm.$nextTick().then(() => { - expect(findButton().props('loading')).toBe(true); - }); + await nextTick(); + expect(findButton().props('loading')).toBe(true); }); }); |