diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/frontend/vue_mr_widget | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/frontend/vue_mr_widget')
36 files changed, 231 insertions, 153 deletions
diff --git a/spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js b/spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js index fd8b0dddc61..d6a1c2d3b07 100644 --- a/spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js +++ b/spec/frontend/vue_mr_widget/components/approvals/approvals_spec.js @@ -1,9 +1,9 @@ -import { shallowMount } from '@vue/test-utils'; import { GlButton } from '@gitlab/ui'; +import { shallowMount } from '@vue/test-utils'; +import { deprecatedCreateFlash as createFlash } from '~/flash'; import Approvals from '~/vue_merge_request_widget/components/approvals/approvals.vue'; import ApprovalsSummary from '~/vue_merge_request_widget/components/approvals/approvals_summary.vue'; import ApprovalsSummaryOptional from '~/vue_merge_request_widget/components/approvals/approvals_summary_optional.vue'; -import { deprecatedCreateFlash as createFlash } from '~/flash'; import { FETCH_LOADING, FETCH_ERROR, diff --git a/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_optional_spec.js b/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_optional_spec.js index d9a5230f55f..65cafc647e0 100644 --- a/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_optional_spec.js +++ b/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_optional_spec.js @@ -1,5 +1,5 @@ -import { shallowMount } from '@vue/test-utils'; import { GlLink } from '@gitlab/ui'; +import { shallowMount } from '@vue/test-utils'; import ApprovalsSummaryOptional from '~/vue_merge_request_widget/components/approvals/approvals_summary_optional.vue'; const TEST_HELP_PATH = 'help/path'; diff --git a/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js b/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js index b8ba619fbb1..ef712ec23a6 100644 --- a/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js +++ b/spec/frontend/vue_mr_widget/components/approvals/approvals_summary_spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; -import { APPROVED_MESSAGE } from '~/vue_merge_request_widget/components/approvals/messages'; -import ApprovalsSummary from '~/vue_merge_request_widget/components/approvals/approvals_summary.vue'; import { toNounSeriesText } from '~/lib/utils/grammar'; +import ApprovalsSummary from '~/vue_merge_request_widget/components/approvals/approvals_summary.vue'; +import { APPROVED_MESSAGE } from '~/vue_merge_request_widget/components/approvals/messages'; import UserAvatarList from '~/vue_shared/components/user_avatar/user_avatar_list.vue'; const testApprovers = () => Array.from({ length: 5 }, (_, i) => i).map((id) => ({ id })); diff --git a/spec/frontend/vue_mr_widget/components/artifacts_list_app_spec.js b/spec/frontend/vue_mr_widget/components/artifacts_list_app_spec.js index 2e1e21299b3..b2cc7d9be6b 100644 --- a/spec/frontend/vue_mr_widget/components/artifacts_list_app_spec.js +++ b/spec/frontend/vue_mr_widget/components/artifacts_list_app_spec.js @@ -1,8 +1,8 @@ +import { GlLoadingIcon } from '@gitlab/ui'; import { mount } from '@vue/test-utils'; -import Vuex from 'vuex'; -import Vue, { nextTick } from 'vue'; import MockAdapter from 'axios-mock-adapter'; -import { GlLoadingIcon } from '@gitlab/ui'; +import Vue, { nextTick } from 'vue'; +import Vuex from 'vuex'; import { TEST_HOST as FAKE_ENDPOINT } from 'helpers/test_constants'; import axios from '~/lib/utils/axios_utils'; import ArtifactsListApp from '~/vue_merge_request_widget/components/artifacts_list_app.vue'; diff --git a/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js b/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js index fd432381512..712abfe228a 100644 --- a/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js +++ b/spec/frontend/vue_mr_widget/components/artifacts_list_spec.js @@ -1,5 +1,5 @@ -import { shallowMount } from '@vue/test-utils'; import { GlLink } from '@gitlab/ui'; +import { shallowMount } from '@vue/test-utils'; import ArtifactsList from '~/vue_merge_request_widget/components/artifacts_list.vue'; import { artifacts } from '../mock_data'; diff --git a/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js b/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js index ba2a8ee0a41..94d4cccab5f 100644 --- a/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_collapsible_extension_spec.js @@ -1,5 +1,5 @@ -import { mount } from '@vue/test-utils'; import { GlLoadingIcon } from '@gitlab/ui'; +import { mount } from '@vue/test-utils'; import MrCollapsibleSection from '~/vue_merge_request_widget/components/mr_collapsible_extension.vue'; describe('Merge Request Collapsible Extension', () => { diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js index 720ce613b85..07e869a070f 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_alert_message_spec.js @@ -1,5 +1,5 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; import { GlLink } from '@gitlab/ui'; +import { shallowMount, createLocalVue } from '@vue/test-utils'; import MrWidgetAlertMessage from '~/vue_merge_request_widget/components/mr_widget_alert_message.vue'; describe('MrWidgetAlertMessage', () => { diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_icon_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_icon_spec.js index 4bcae904ddc..ebd10f31fa7 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_icon_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_icon_spec.js @@ -1,5 +1,5 @@ -import { shallowMount } from '@vue/test-utils'; import { GlIcon } from '@gitlab/ui'; +import { shallowMount } from '@vue/test-utils'; import MrWidgetIcon from '~/vue_merge_request_widget/components/mr_widget_icon.vue'; const TEST_ICON = 'commit'; diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js index 79a0dd1e760..f55d313a719 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_memory_usage_spec.js @@ -1,6 +1,6 @@ -import Vue from 'vue'; import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; +import Vue from 'vue'; import MemoryUsage from '~/vue_merge_request_widget/components/deployment/memory_usage.vue'; import MRWidgetService from '~/vue_merge_request_widget/services/mr_widget_service'; diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js index 7ff8d9678fe..3baade5161e 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_container_spec.js @@ -1,10 +1,10 @@ import { mount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; -import MrWidgetPipelineContainer from '~/vue_merge_request_widget/components/mr_widget_pipeline_container.vue'; -import MrWidgetPipeline from '~/vue_merge_request_widget/components/mr_widget_pipeline.vue'; +import axios from '~/lib/utils/axios_utils'; import ArtifactsApp from '~/vue_merge_request_widget/components/artifacts_list_app.vue'; +import MrWidgetPipeline from '~/vue_merge_request_widget/components/mr_widget_pipeline.vue'; +import MrWidgetPipelineContainer from '~/vue_merge_request_widget/components/mr_widget_pipeline_container.vue'; import { mockStore } from '../mock_data'; -import axios from '~/lib/utils/axios_utils'; describe('MrWidgetPipelineContainer', () => { let wrapper; diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js index 3e5ab5cd32d..b93236d4628 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_pipeline_spec.js @@ -1,9 +1,9 @@ -import { shallowMount, mount } from '@vue/test-utils'; import { GlLoadingIcon } from '@gitlab/ui'; +import { shallowMount, mount } from '@vue/test-utils'; import { trimText } from 'helpers/text_helper'; -import { SUCCESS } from '~/vue_merge_request_widget/constants'; -import PipelineComponent from '~/vue_merge_request_widget/components/mr_widget_pipeline.vue'; import PipelineStage from '~/pipelines/components/pipelines_list/stage.vue'; +import PipelineComponent from '~/vue_merge_request_widget/components/mr_widget_pipeline.vue'; +import { SUCCESS } from '~/vue_merge_request_widget/constants'; import mockData from '../mock_data'; describe('MRWidgetPipeline', () => { diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js index bdd038edd71..5081e1e5906 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_rebase_spec.js @@ -1,7 +1,7 @@ -import { nextTick } from 'vue'; import { shallowMount } from '@vue/test-utils'; -import eventHub from '~/vue_merge_request_widget/event_hub'; +import { nextTick } from 'vue'; import WidgetRebase from '~/vue_merge_request_widget/components/states/mr_widget_rebase.vue'; +import eventHub from '~/vue_merge_request_widget/event_hub'; let wrapper; diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_status_icon_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_status_icon_spec.js index 6c3b4a01659..c25e10c5249 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_status_icon_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_status_icon_spec.js @@ -1,48 +1,60 @@ -import Vue from 'vue'; -import mountComponent from 'helpers/vue_mount_component_helper'; +import { GlLoadingIcon } from '@gitlab/ui'; +import { shallowMount, mount } from '@vue/test-utils'; import mrStatusIcon from '~/vue_merge_request_widget/components/mr_widget_status_icon.vue'; describe('MR widget status icon component', () => { - let vm; - let Component; + let wrapper; - beforeEach(() => { - Component = Vue.extend(mrStatusIcon); - }); + const findLoadingIcon = () => wrapper.find(GlLoadingIcon); + const findDisabledMergeButton = () => wrapper.find('[data-testid="disabled-merge-button"]'); + + const createWrapper = (props, mountFn = shallowMount) => { + wrapper = mountFn(mrStatusIcon, { + propsData: { + ...props, + }, + }); + }; afterEach(() => { - vm.$destroy(); + wrapper.destroy(); }); describe('while loading', () => { it('renders loading icon', () => { - vm = mountComponent(Component, { status: 'loading' }); + createWrapper({ status: 'loading' }); - expect(vm.$el.querySelector('.mr-widget-icon span').classList).toContain('gl-spinner'); + expect(findLoadingIcon().exists()).toBe(true); }); }); describe('with status icon', () => { - it('renders ci status icon', () => { - vm = mountComponent(Component, { status: 'failed' }); + it('renders success status icon', () => { + createWrapper({ status: 'success' }, mount); + + expect(wrapper.find('[data-testid="status_success-icon"]').exists()).toBe(true); + }); + + it('renders failed status icon', () => { + createWrapper({ status: 'failed' }, mount); - expect(vm.$el.querySelector('.js-ci-status-icon-failed')).not.toBeNull(); + expect(wrapper.find('[data-testid="status_failed-icon"]').exists()).toBe(true); }); }); describe('with disabled button', () => { it('renders a disabled button', () => { - vm = mountComponent(Component, { status: 'failed', showDisabledButton: true }); + createWrapper({ status: 'failed', showDisabledButton: true }); - expect(vm.$el.querySelector('.js-disabled-merge-button').textContent.trim()).toEqual('Merge'); + expect(findDisabledMergeButton().exists()).toBe(true); }); }); describe('without disabled button', () => { it('does not render a disabled button', () => { - vm = mountComponent(Component, { status: 'failed' }); + createWrapper({ status: 'failed' }); - expect(vm.$el.querySelector('.js-disabled-merge-button')).toBeNull(); + expect(findDisabledMergeButton().exists()).toBe(false); }); }); }); diff --git a/spec/frontend/vue_mr_widget/components/mr_widget_suggest_pipeline_spec.js b/spec/frontend/vue_mr_widget/components/mr_widget_suggest_pipeline_spec.js index 8fcc982ac99..b5afc1ab21a 100644 --- a/spec/frontend/vue_mr_widget/components/mr_widget_suggest_pipeline_spec.js +++ b/spec/frontend/vue_mr_widget/components/mr_widget_suggest_pipeline_spec.js @@ -1,12 +1,10 @@ -import { mount, shallowMount } from '@vue/test-utils'; import { GlLink, GlSprintf } from '@gitlab/ui'; -import { mockTracking, triggerEvent, unmockTracking } from 'helpers/tracking_helper'; +import { mount, shallowMount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; -import suggestPipelineComponent from '~/vue_merge_request_widget/components/mr_widget_suggest_pipeline.vue'; -import MrWidgetIcon from '~/vue_merge_request_widget/components/mr_widget_icon.vue'; -import dismissibleContainer from '~/vue_shared/components/dismissible_container.vue'; -import { suggestProps, iconName } from './pipeline_tour_mock_data'; +import { mockTracking, triggerEvent, unmockTracking } from 'helpers/tracking_helper'; import axios from '~/lib/utils/axios_utils'; +import MrWidgetIcon from '~/vue_merge_request_widget/components/mr_widget_icon.vue'; +import suggestPipelineComponent from '~/vue_merge_request_widget/components/mr_widget_suggest_pipeline.vue'; import { SP_TRACK_LABEL, SP_LINK_TRACK_EVENT, @@ -15,6 +13,8 @@ import { SP_SHOW_TRACK_VALUE, SP_HELP_URL, } from '~/vue_merge_request_widget/constants'; +import dismissibleContainer from '~/vue_shared/components/dismissible_container.vue'; +import { suggestProps, iconName } from './pipeline_tour_mock_data'; describe('MRWidgetSuggestPipeline', () => { describe('template', () => { diff --git a/spec/frontend/vue_mr_widget/components/states/__snapshots__/mr_widget_pipeline_failed_spec.js.snap b/spec/frontend/vue_mr_widget/components/states/__snapshots__/mr_widget_pipeline_failed_spec.js.snap new file mode 100644 index 00000000000..a124008b36a --- /dev/null +++ b/spec/frontend/vue_mr_widget/components/states/__snapshots__/mr_widget_pipeline_failed_spec.js.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`PipelineFailed should render error message with a disabled merge button 1`] = ` +<div + class="mr-widget-body media" +> + <status-icon-stub + showdisabledbutton="true" + status="warning" + /> + + <div + class="media-body space-children" + > + <span + class="bold" + > + <gl-sprintf-stub + message="The pipeline for this merge request did not complete. Push a new commit to fix the failure, or check the %{linkStart}troubleshooting documentation%{linkEnd} to see other possible actions." + /> + </span> + </div> +</div> +`; diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js index 850bbd93df5..4dd1bd2aa9c 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_auto_merge_enabled_spec.js @@ -1,11 +1,11 @@ -import { nextTick } from 'vue'; import { shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; import { trimText } from 'helpers/text_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import autoMergeEnabledComponent from '~/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue'; -import MRWidgetService from '~/vue_merge_request_widget/services/mr_widget_service'; -import eventHub from '~/vue_merge_request_widget/event_hub'; import { MWPS_MERGE_STRATEGY } from '~/vue_merge_request_widget/constants'; +import eventHub from '~/vue_merge_request_widget/event_hub'; +import MRWidgetService from '~/vue_merge_request_widget/services/mr_widget_service'; let wrapper; let mergeRequestWidgetGraphqlEnabled = false; @@ -202,7 +202,11 @@ describe('MRWidgetAutoMergeEnabled', () => { wrapper.vm.cancelAutomaticMerge(); setImmediate(() => { expect(wrapper.vm.isCancellingAutoMerge).toBeTruthy(); - expect(eventHub.$emit).toHaveBeenCalledWith('UpdateWidgetData', mrObj); + if (mergeRequestWidgetGraphql) { + expect(eventHub.$emit).toHaveBeenCalledWith('MRWidgetUpdateRequested'); + } else { + expect(eventHub.$emit).toHaveBeenCalledWith('UpdateWidgetData', mrObj); + } done(); }); }); 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 index dca3798f7ea..24198096564 100644 --- 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 @@ -1,6 +1,6 @@ -import { nextTick } from 'vue'; -import { shallowMount } from '@vue/test-utils'; 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'; diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_commit_message_dropdown_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_commit_message_dropdown_spec.js index 706d60368b5..4c763f40cbe 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_commit_message_dropdown_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_commit_message_dropdown_spec.js @@ -1,5 +1,5 @@ -import { shallowMount } from '@vue/test-utils'; import { GlDropdownItem } from '@gitlab/ui'; +import { shallowMount } from '@vue/test-utils'; import CommitMessageDropdown from '~/vue_merge_request_widget/components/states/commit_message_dropdown.vue'; const commits = [ diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js index f5a059698b6..d3fc1e0e05b 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_conflicts_spec.js @@ -1,7 +1,7 @@ -import $ from 'jquery'; import { createLocalVue, shallowMount } from '@vue/test-utils'; -import { removeBreakLine } from 'helpers/text_helper'; +import $ from 'jquery'; import { TEST_HOST } from 'helpers/test_constants'; +import { removeBreakLine } from 'helpers/text_helper'; import ConflictsComponent from '~/vue_merge_request_widget/components/states/mr_widget_conflicts.vue'; describe('MRWidgetConflicts', () => { diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js index 48c1a9eedf9..c1471314c4a 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js @@ -54,7 +54,7 @@ describe('MRWidgetFailedToMerge', () => { Vue.nextTick() .then(() => { - expect(vm.mergeError).toBe('contains line breaks'); + expect(vm.mergeError).toBe('contains line breaks.'); }) .then(done) .catch(done.fail); @@ -113,14 +113,14 @@ describe('MRWidgetFailedToMerge', () => { describe('while it is not regresing', () => { it('renders warning icon and disabled merge button', () => { expect(vm.$el.querySelector('.js-ci-status-icon-warning')).not.toBeNull(); - expect(vm.$el.querySelector('.js-disabled-merge-button').getAttribute('disabled')).toEqual( - 'disabled', - ); + expect( + vm.$el.querySelector('[data-testid="disabled-merge-button"]').getAttribute('disabled'), + ).toEqual('disabled'); }); it('renders given error', () => { expect(vm.$el.querySelector('.has-error-message').textContent.trim()).toEqual( - 'Merge error happened', + 'Merge error happened.', ); }); diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js index 36c4174c03d..6af8ac9e18e 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_merged_spec.js @@ -1,5 +1,8 @@ +import { getByRole } from '@testing-library/dom'; import Vue from 'vue'; import mountComponent from 'helpers/vue_mount_component_helper'; +import { OPEN_REVERT_MODAL, OPEN_CHERRY_PICK_MODAL } from '~/projects/commit/constants'; +import modalEventHub from '~/projects/commit/event_hub'; import mergedComponent from '~/vue_merge_request_widget/components/states/mr_widget_merged.vue'; import eventHub from '~/vue_merge_request_widget/event_hub'; @@ -16,6 +19,7 @@ describe('MRWidgetMerged', () => { }; beforeEach(() => { + jest.spyOn(document, 'dispatchEvent'); const Component = Vue.extend(mergedComponent); const mr = { isRemovingSourceBranch: false, @@ -147,6 +151,26 @@ describe('MRWidgetMerged', () => { }); }); + it('calls dispatchDocumentEvent to load in the modal component', () => { + expect(document.dispatchEvent).toHaveBeenCalledWith(new CustomEvent('merged:UpdateActions')); + }); + + it('emits event to open the revert modal on revert button click', () => { + const eventHubSpy = jest.spyOn(modalEventHub, '$emit'); + + getByRole(vm.$el, 'button', { name: /Revert/i }).click(); + + expect(eventHubSpy).toHaveBeenCalledWith(OPEN_REVERT_MODAL); + }); + + it('emits event to open the cherry-pick modal on cherry-pick button click', () => { + const eventHubSpy = jest.spyOn(modalEventHub, '$emit'); + + getByRole(vm.$el, 'button', { name: /Cherry-pick/i }).click(); + + expect(eventHubSpy).toHaveBeenCalledWith(OPEN_CHERRY_PICK_MODAL); + }); + it('has merged by information', () => { expect(vm.$el.textContent).toContain('Merged by'); expect(vm.$el.textContent).toContain('Administrator'); diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js index 8847e4e6bdd..bd77a1d657e 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js @@ -1,25 +1,27 @@ -import Vue from 'vue'; -import mountComponent from 'helpers/vue_mount_component_helper'; -import { removeBreakLine } from 'helpers/text_helper'; -import pipelineBlockedComponent from '~/vue_merge_request_widget/components/states/mr_widget_pipeline_blocked.vue'; +import { shallowMount, mount } from '@vue/test-utils'; +import PipelineBlockedComponent from '~/vue_merge_request_widget/components/states/mr_widget_pipeline_blocked.vue'; describe('MRWidgetPipelineBlocked', () => { - let vm; - beforeEach(() => { - const Component = Vue.extend(pipelineBlockedComponent); - vm = mountComponent(Component); - }); + let wrapper; + + const createWrapper = (mountFn = shallowMount) => { + wrapper = mountFn(PipelineBlockedComponent); + }; afterEach(() => { - vm.$destroy(); + wrapper.destroy(); }); it('renders warning icon', () => { - expect(vm.$el.querySelector('.ci-status-icon-warning')).not.toBe(null); + createWrapper(mount); + + expect(wrapper.find('.ci-status-icon-warning').exists()).toBe(true); }); it('renders information text', () => { - expect(removeBreakLine(vm.$el.textContent).trim()).toContain( + createWrapper(); + + expect(wrapper.text()).toBe( 'Pipeline blocked. The pipeline for this merge request requires a manual action to proceed', ); }); diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_pipeline_failed_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_pipeline_failed_spec.js index 179adef12d9..3e0840fef4e 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_pipeline_failed_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_pipeline_failed_spec.js @@ -1,19 +1,30 @@ -import Vue from 'vue'; -import { removeBreakLine } from 'helpers/text_helper'; +import { shallowMount } from '@vue/test-utils'; +import statusIcon from '~/vue_merge_request_widget/components/mr_widget_status_icon.vue'; import PipelineFailed from '~/vue_merge_request_widget/components/states/pipeline_failed.vue'; describe('PipelineFailed', () => { - describe('template', () => { - const Component = Vue.extend(PipelineFailed); - const vm = new Component({ - el: document.createElement('div'), - }); - it('should have correct elements', () => { - expect(vm.$el.classList.contains('mr-widget-body')).toBeTruthy(); - expect(vm.$el.querySelector('button').getAttribute('disabled')).toBeTruthy(); - expect(removeBreakLine(vm.$el.innerText).trim()).toContain( - 'The pipeline for this merge request failed. Please retry the job or push a new commit to fix the failure', - ); - }); + let wrapper; + + const createComponent = () => { + wrapper = shallowMount(PipelineFailed); + }; + + const findStatusIcon = () => wrapper.find(statusIcon); + + beforeEach(() => { + createComponent(); + }); + + afterEach(() => { + wrapper.destroy(); + wrapper = null; + }); + + it('should render error message with a disabled merge button', () => { + expect(wrapper.element).toMatchSnapshot(); + }); + + it('merge button should be disabled', () => { + expect(findStatusIcon().props('showDisabledButton')).toBe(true); }); }); diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js index 8eddf59820c..983e4a35078 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js @@ -1,14 +1,14 @@ -import Vue from 'vue'; import { createLocalVue, shallowMount } from '@vue/test-utils'; -import ReadyToMerge from '~/vue_merge_request_widget/components/states/ready_to_merge.vue'; -import SquashBeforeMerge from '~/vue_merge_request_widget/components/states/squash_before_merge.vue'; -import CommitsHeader from '~/vue_merge_request_widget/components/states/commits_header.vue'; +import Vue from 'vue'; +import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests'; +import simplePoll from '~/lib/utils/simple_poll'; import CommitEdit from '~/vue_merge_request_widget/components/states/commit_edit.vue'; import CommitMessageDropdown from '~/vue_merge_request_widget/components/states/commit_message_dropdown.vue'; -import eventHub from '~/vue_merge_request_widget/event_hub'; +import CommitsHeader from '~/vue_merge_request_widget/components/states/commits_header.vue'; +import ReadyToMerge from '~/vue_merge_request_widget/components/states/ready_to_merge.vue'; +import SquashBeforeMerge from '~/vue_merge_request_widget/components/states/squash_before_merge.vue'; import { MWPS_MERGE_STRATEGY, MTWPS_MERGE_STRATEGY } from '~/vue_merge_request_widget/constants'; -import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests'; -import simplePoll from '~/lib/utils/simple_poll'; +import eventHub from '~/vue_merge_request_widget/event_hub'; jest.mock('~/lib/utils/simple_poll', () => jest.fn().mockImplementation(jest.requireActual('~/lib/utils/simple_poll').default), diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js index 38920846a50..ef6a9b1e8fc 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js @@ -1,6 +1,6 @@ import Vue from 'vue'; -import mountComponent from 'helpers/vue_mount_component_helper'; import { removeBreakLine } from 'helpers/text_helper'; +import mountComponent from 'helpers/vue_mount_component_helper'; import ShaMismatch from '~/vue_merge_request_widget/components/states/sha_mismatch.vue'; describe('ShaMismatch', () => { diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js index cc160f6182d..8ead0002950 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_squash_before_merge_spec.js @@ -1,5 +1,5 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; import { GlFormCheckbox } from '@gitlab/ui'; +import { createLocalVue, shallowMount } from '@vue/test-utils'; import SquashBeforeMerge from '~/vue_merge_request_widget/components/states/squash_before_merge.vue'; import { SQUASH_BEFORE_MERGE } from '~/vue_merge_request_widget/i18n'; diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_unresolved_discussions_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_unresolved_discussions_spec.js index a5531577a8c..6c0d69ea109 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_unresolved_discussions_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_unresolved_discussions_spec.js @@ -1,7 +1,7 @@ import { mount } from '@vue/test-utils'; import { TEST_HOST } from 'helpers/test_constants'; -import UnresolvedDiscussions from '~/vue_merge_request_widget/components/states/unresolved_discussions.vue'; import notesEventHub from '~/notes/event_hub'; +import UnresolvedDiscussions from '~/vue_merge_request_widget/components/states/unresolved_discussions.vue'; function createComponent({ path = '' } = {}) { return mount(UnresolvedDiscussions, { diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js index 6d63d4b1be3..e0077a008a2 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_wip_spec.js @@ -1,7 +1,7 @@ import Vue from 'vue'; +import { deprecatedCreateFlash as createFlash } from '~/flash'; import WorkInProgress from '~/vue_merge_request_widget/components/states/work_in_progress.vue'; import eventHub from '~/vue_merge_request_widget/event_hub'; -import { deprecatedCreateFlash as createFlash } from '~/flash'; jest.mock('~/flash'); diff --git a/spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js b/spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js index 8da0d0f16d6..364f849eb4f 100644 --- a/spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js +++ b/spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js @@ -1,12 +1,12 @@ import { GlDeprecatedSkeletonLoading as GlSkeletonLoading, GlSprintf } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; -import { invalidPlanWithName, plans, validPlanWithName } from './mock_data'; import axios from '~/lib/utils/axios_utils'; +import Poll from '~/lib/utils/poll'; import MrWidgetExpanableSection from '~/vue_merge_request_widget/components/mr_widget_expandable_section.vue'; import MrWidgetTerraformContainer from '~/vue_merge_request_widget/components/terraform/mr_widget_terraform_container.vue'; -import Poll from '~/lib/utils/poll'; import TerraformPlan from '~/vue_merge_request_widget/components/terraform/terraform_plan.vue'; +import { invalidPlanWithName, plans, validPlanWithName } from './mock_data'; describe('MrWidgetTerraformConainer', () => { let mock; diff --git a/spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js b/spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js index ea4eb44ebfe..f95a92c2cb1 100644 --- a/spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js +++ b/spec/frontend/vue_mr_widget/components/terraform/terraform_plan_spec.js @@ -33,7 +33,7 @@ describe('TerraformPlan', () => { it('diplays the header text with a name', () => { expect(wrapper.text()).toContain( - `The Terraform report ${validPlanWithName.job_name} was generated in your pipelines.`, + `The report ${validPlanWithName.job_name} was generated in your pipelines.`, ); }); @@ -55,7 +55,7 @@ describe('TerraformPlan', () => { }); it('diplays the header text without a name', () => { - expect(wrapper.text()).toContain('A Terraform report was generated in your pipelines.'); + expect(wrapper.text()).toContain('A report was generated in your pipelines.'); }); }); @@ -70,7 +70,7 @@ describe('TerraformPlan', () => { it('diplays the header text with a name', () => { expect(wrapper.text()).toContain( - `The Terraform report ${invalidPlanWithName.job_name} failed to generate.`, + `The report ${invalidPlanWithName.job_name} failed to generate.`, ); }); @@ -85,7 +85,7 @@ describe('TerraformPlan', () => { }); it('diplays the header text without a name', () => { - expect(wrapper.text()).toContain('A Terraform report failed to generate.'); + expect(wrapper.text()).toContain('A report failed to generate.'); }); it('does not render button because url is missing', () => { diff --git a/spec/frontend/vue_mr_widget/deployment/deployment_action_button_spec.js b/spec/frontend/vue_mr_widget/deployment/deployment_action_button_spec.js index bc0d2501809..8c5036e35f6 100644 --- a/spec/frontend/vue_mr_widget/deployment/deployment_action_button_spec.js +++ b/spec/frontend/vue_mr_widget/deployment/deployment_action_button_spec.js @@ -1,12 +1,12 @@ -import { mount } from '@vue/test-utils'; import { GlIcon, GlLoadingIcon, GlButton } from '@gitlab/ui'; -import DeploymentActionButton from '~/vue_merge_request_widget/components/deployment/deployment_action_button.vue'; +import { mount } from '@vue/test-utils'; import { CREATED, RUNNING, DEPLOYING, REDEPLOYING, } from '~/vue_merge_request_widget/components/deployment/constants'; +import DeploymentActionButton from '~/vue_merge_request_widget/components/deployment/deployment_action_button.vue'; import { actionButtonMocks } from './deployment_mock_data'; const baseProps = { diff --git a/spec/frontend/vue_mr_widget/deployment/deployment_actions_spec.js b/spec/frontend/vue_mr_widget/deployment/deployment_actions_spec.js index 13c0665f929..22e58ac6abf 100644 --- a/spec/frontend/vue_mr_widget/deployment/deployment_actions_spec.js +++ b/spec/frontend/vue_mr_widget/deployment/deployment_actions_spec.js @@ -1,8 +1,6 @@ import { mount } from '@vue/test-utils'; import { deprecatedCreateFlash as createFlash } from '~/flash'; import { visitUrl } from '~/lib/utils/url_utility'; -import MRWidgetService from '~/vue_merge_request_widget/services/mr_widget_service'; -import DeploymentActions from '~/vue_merge_request_widget/components/deployment/deployment_actions.vue'; import { CREATED, MANUAL_DEPLOY, @@ -11,6 +9,8 @@ import { REDEPLOYING, STOPPING, } from '~/vue_merge_request_widget/components/deployment/constants'; +import DeploymentActions from '~/vue_merge_request_widget/components/deployment/deployment_actions.vue'; +import MRWidgetService from '~/vue_merge_request_widget/services/mr_widget_service'; import { actionButtonMocks, deploymentMockData, diff --git a/spec/frontend/vue_mr_widget/deployment/deployment_spec.js b/spec/frontend/vue_mr_widget/deployment/deployment_spec.js index 87bf32351bd..c27cbd8b781 100644 --- a/spec/frontend/vue_mr_widget/deployment/deployment_spec.js +++ b/spec/frontend/vue_mr_widget/deployment/deployment_spec.js @@ -1,7 +1,4 @@ import { mount } from '@vue/test-utils'; -import DeploymentComponent from '~/vue_merge_request_widget/components/deployment/deployment.vue'; -import DeploymentInfo from '~/vue_merge_request_widget/components/deployment/deployment_info.vue'; -import DeploymentViewButton from '~/vue_merge_request_widget/components/deployment/deployment_view_button.vue'; import { CREATED, RUNNING, @@ -10,6 +7,9 @@ import { CANCELED, SKIPPED, } from '~/vue_merge_request_widget/components/deployment/constants'; +import DeploymentComponent from '~/vue_merge_request_widget/components/deployment/deployment.vue'; +import DeploymentInfo from '~/vue_merge_request_widget/components/deployment/deployment_info.vue'; +import DeploymentViewButton from '~/vue_merge_request_widget/components/deployment/deployment_view_button.vue'; import { deploymentMockData, playDetails, retryDetails } from './deployment_mock_data'; describe('Deployment component', () => { diff --git a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js index 1ea7fe1fbfe..7b020813bd5 100644 --- a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js +++ b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js @@ -1,28 +1,26 @@ import { mount } from '@vue/test-utils'; -import Vue, { nextTick } from 'vue'; import MockAdapter from 'axios-mock-adapter'; -import Api from '~/api'; +import Vue, { nextTick } from 'vue'; +import VueApollo from 'vue-apollo'; +import createMockApollo from 'helpers/mock_apollo_helper'; +import { securityReportDownloadPathsQueryResponse } from 'jest/vue_shared/security_reports/mock_data'; import axios from '~/lib/utils/axios_utils'; -import MrWidgetOptions from '~/vue_merge_request_widget/mr_widget_options.vue'; -import eventHub from '~/vue_merge_request_widget/event_hub'; +import { setFaviconOverlay } from '~/lib/utils/favicon'; import notify from '~/lib/utils/notify'; import SmartInterval from '~/smart_interval'; -import { setFaviconOverlay } from '~/lib/utils/favicon'; +import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/constants'; +import eventHub from '~/vue_merge_request_widget/event_hub'; +import MrWidgetOptions from '~/vue_merge_request_widget/mr_widget_options.vue'; import { stateKey } from '~/vue_merge_request_widget/stores/state_maps'; -import mockData from './mock_data'; +import securityReportDownloadPathsQuery from '~/vue_shared/security_reports/queries/security_report_download_paths.query.graphql'; import { faviconDataUrl, overlayDataUrl } from '../lib/utils/mock_data'; -import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/constants'; +import mockData from './mock_data'; jest.mock('~/smart_interval'); jest.mock('~/lib/utils/favicon'); -const returnPromise = (data) => - new Promise((resolve) => { - resolve({ - data, - }); - }); +Vue.use(VueApollo); describe('MrWidgetOptions', () => { let wrapper; @@ -48,7 +46,7 @@ describe('MrWidgetOptions', () => { gon.features = {}; }); - const createComponent = (mrData = mockData) => { + const createComponent = (mrData = mockData, options = {}) => { if (wrapper) { wrapper.destroy(); } @@ -57,6 +55,7 @@ describe('MrWidgetOptions', () => { propsData: { mrData: { ...mrData }, }, + ...options, }); return axios.waitForAll(); @@ -68,6 +67,7 @@ describe('MrWidgetOptions', () => { describe('default', () => { beforeEach(() => { + jest.spyOn(document, 'dispatchEvent'); return createComponent(); }); @@ -281,7 +281,7 @@ describe('MrWidgetOptions', () => { let isCbExecuted; beforeEach(() => { - jest.spyOn(wrapper.vm.service, 'checkStatus').mockReturnValue(returnPromise(mockData)); + jest.spyOn(wrapper.vm.service, 'checkStatus').mockResolvedValue({ data: mockData }); jest.spyOn(wrapper.vm.mr, 'setData').mockImplementation(() => {}); jest.spyOn(wrapper.vm, 'handleNotification').mockImplementation(() => {}); @@ -331,7 +331,7 @@ describe('MrWidgetOptions', () => { it('should fetch deployments', () => { jest .spyOn(wrapper.vm.service, 'fetchDeployments') - .mockReturnValue(returnPromise([{ id: 1, status: SUCCESS }])); + .mockResolvedValue({ data: [{ id: 1, status: SUCCESS }] }); wrapper.vm.fetchPreMergeDeployments(); @@ -347,13 +347,16 @@ describe('MrWidgetOptions', () => { it('should fetch content of Cherry Pick and Revert modals', () => { jest .spyOn(wrapper.vm.service, 'fetchMergeActionsContent') - .mockReturnValue(returnPromise('hello world')); + .mockResolvedValue({ data: 'hello world' }); wrapper.vm.fetchActionsContent(); return nextTick().then(() => { expect(wrapper.vm.service.fetchMergeActionsContent).toHaveBeenCalled(); expect(document.body.textContent).toContain('hello world'); + expect(document.dispatchEvent).toHaveBeenCalledWith( + new CustomEvent('merged:UpdateActions'), + ); }); }); }); @@ -822,36 +825,34 @@ describe('MrWidgetOptions', () => { describe('security widget', () => { describe.each` - context | hasPipeline | reportType | isFlagEnabled | shouldRender - ${'security report and flag enabled'} | ${true} | ${'sast'} | ${true} | ${true} - ${'security report and flag disabled'} | ${true} | ${'sast'} | ${false} | ${false} - ${'no security report and flag enabled'} | ${true} | ${'foo'} | ${true} | ${false} - ${'no pipeline and flag enabled'} | ${false} | ${'sast'} | ${true} | ${false} - `('given $context', ({ hasPipeline, reportType, isFlagEnabled, shouldRender }) => { + context | hasPipeline | shouldRender + ${'there is a pipeline'} | ${true} | ${true} + ${'no pipeline'} | ${false} | ${false} + `('given $context', ({ hasPipeline, shouldRender }) => { beforeEach(() => { - gon.features.coreSecurityMrWidget = isFlagEnabled; + const mrData = { + ...mockData, + ...(hasPipeline ? {} : { pipeline: null }), + }; - if (hasPipeline) { - jest.spyOn(Api, 'pipelineJobs').mockResolvedValue({ - data: [{ artifacts: [{ file_type: reportType }] }], - }); - } + // Override top-level mocked requests, which always use a fresh copy of + // mockData, which always includes the full pipeline object. + mock.onGet(mockData.merge_request_widget_path).reply(() => [200, mrData]); + mock.onGet(mockData.merge_request_cached_widget_path).reply(() => [200, mrData]); - return createComponent({ - ...mockData, - ...(hasPipeline ? {} : { pipeline: undefined }), + return createComponent(mrData, { + apolloProvider: createMockApollo([ + [ + securityReportDownloadPathsQuery, + async () => ({ data: securityReportDownloadPathsQueryResponse }), + ], + ]), }); }); - if (shouldRender) { - it('renders', () => { - expect(findSecurityMrWidget().exists()).toBe(true); - }); - } else { - it('does not render', () => { - expect(findSecurityMrWidget().exists()).toBe(false); - }); - } + it(shouldRender ? 'renders' : 'does not render', () => { + expect(findSecurityMrWidget().exists()).toBe(shouldRender); + }); }); }); diff --git a/spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js b/spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js index 1dfa7564535..9423fa17c44 100644 --- a/spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js +++ b/spec/frontend/vue_mr_widget/stores/artifacts_list/actions_spec.js @@ -1,6 +1,6 @@ import MockAdapter from 'axios-mock-adapter'; -import testAction from 'helpers/vuex_action_helper'; import { TEST_HOST } from 'helpers/test_constants'; +import testAction from 'helpers/vuex_action_helper'; import axios from '~/lib/utils/axios_utils'; import { setEndpoint, @@ -11,8 +11,8 @@ import { receiveArtifactsSuccess, receiveArtifactsError, } from '~/vue_merge_request_widget/stores/artifacts_list/actions'; -import state from '~/vue_merge_request_widget/stores/artifacts_list/state'; import * as types from '~/vue_merge_request_widget/stores/artifacts_list/mutation_types'; +import state from '~/vue_merge_request_widget/stores/artifacts_list/state'; describe('Artifacts App Store Actions', () => { let mockedState; diff --git a/spec/frontend/vue_mr_widget/stores/artifacts_list/mutations_spec.js b/spec/frontend/vue_mr_widget/stores/artifacts_list/mutations_spec.js index ea89fdb72e9..a4e6788c7f6 100644 --- a/spec/frontend/vue_mr_widget/stores/artifacts_list/mutations_spec.js +++ b/spec/frontend/vue_mr_widget/stores/artifacts_list/mutations_spec.js @@ -1,6 +1,6 @@ -import state from '~/vue_merge_request_widget/stores/artifacts_list/state'; -import mutations from '~/vue_merge_request_widget/stores/artifacts_list/mutations'; import * as types from '~/vue_merge_request_widget/stores/artifacts_list/mutation_types'; +import mutations from '~/vue_merge_request_widget/stores/artifacts_list/mutations'; +import state from '~/vue_merge_request_widget/stores/artifacts_list/state'; describe('Artifacts Store Mutations', () => { let stateCopy; |