diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_failed_spec.js | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_failed_spec.js')
-rw-r--r-- | spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_failed_spec.js | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_failed_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_failed_spec.js deleted file mode 100644 index 24198096564..00000000000 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_failed_spec.js +++ /dev/null @@ -1,68 +0,0 @@ -import { GlLoadingIcon, GlButton } from '@gitlab/ui'; -import { shallowMount } from '@vue/test-utils'; -import { nextTick } from 'vue'; -import AutoMergeFailedComponent from '~/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.vue'; -import eventHub from '~/vue_merge_request_widget/event_hub'; - -describe('MRWidgetAutoMergeFailed', () => { - let wrapper; - const mergeError = 'This is the merge error'; - const findButton = () => wrapper.find(GlButton); - - const createComponent = (props = {}, mergeRequestWidgetGraphql = false) => { - wrapper = shallowMount(AutoMergeFailedComponent, { - propsData: { ...props }, - data() { - if (mergeRequestWidgetGraphql) { - return { mergeError: props.mr?.mergeError }; - } - - return {}; - }, - provide: { - glFeatures: { mergeRequestWidgetGraphql }, - }, - }); - }; - - afterEach(() => { - wrapper.destroy(); - }); - - [true, false].forEach((mergeRequestWidgetGraphql) => { - describe(`when graphql is ${mergeRequestWidgetGraphql ? 'enabled' : 'dislabed'}`, () => { - beforeEach(() => { - createComponent( - { - mr: { mergeError }, - }, - mergeRequestWidgetGraphql, - ); - }); - - it('renders failed message', () => { - expect(wrapper.text()).toContain('This merge request failed to be merged automatically'); - }); - - it('renders merge error provided', () => { - expect(wrapper.text()).toContain(mergeError); - }); - - it('render refresh button', () => { - expect(findButton().text()).toBe('Refresh'); - }); - - it('emits event and shows loading icon when button is clicked', async () => { - jest.spyOn(eventHub, '$emit'); - findButton().vm.$emit('click'); - - expect(eventHub.$emit.mock.calls[0][0]).toBe('MRWidgetUpdateRequested'); - - await nextTick(); - - expect(findButton().attributes('disabled')).toBe('true'); - expect(wrapper.find(GlLoadingIcon).exists()).toBe(true); - }); - }); - }); -}); |