diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-01 18:08:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-01 18:08:56 +0300 |
commit | e92c95bf459ea6237b1fe1cbd3e6fc7d0eca8f85 (patch) | |
tree | 080fec6e5ea63a30f6d1f313d585266e88db2344 /spec/frontend | |
parent | 9ecdb93f4e7e85ffc1e7a768780bb1279827a6aa (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
151 files changed, 365 insertions, 283 deletions
diff --git a/spec/frontend/__helpers__/graphql_helpers.js b/spec/frontend/__helpers__/graphql_helpers.js new file mode 100644 index 00000000000..63123aa046f --- /dev/null +++ b/spec/frontend/__helpers__/graphql_helpers.js @@ -0,0 +1,14 @@ +/** + * Returns a clone of the given object with all __typename keys omitted, + * including deeply nested ones. + * + * Only works with JSON-serializable objects. + * + * @param {object} An object with __typename keys (e.g., a GraphQL response) + * @returns {object} A new object with no __typename keys + */ +export const stripTypenames = (object) => { + return JSON.parse( + JSON.stringify(object, (key, value) => (key === '__typename' ? undefined : value)), + ); +}; diff --git a/spec/frontend/__helpers__/graphql_helpers_spec.js b/spec/frontend/__helpers__/graphql_helpers_spec.js new file mode 100644 index 00000000000..dd23fbbf4e9 --- /dev/null +++ b/spec/frontend/__helpers__/graphql_helpers_spec.js @@ -0,0 +1,23 @@ +import { stripTypenames } from './graphql_helpers'; + +describe('stripTypenames', () => { + it.each` + input | expected + ${{}} | ${{}} + ${{ __typename: 'Foo' }} | ${{}} + ${{ bar: 'bar', __typename: 'Foo' }} | ${{ bar: 'bar' }} + ${{ bar: { __typename: 'Bar' }, __typename: 'Foo' }} | ${{ bar: {} }} + ${{ bar: [{ __typename: 'Bar' }], __typename: 'Foo' }} | ${{ bar: [{}] }} + ${[]} | ${[]} + ${[{ __typename: 'Foo' }]} | ${[{}]} + ${[{ bar: [{ a: 1, __typename: 'Bar' }] }]} | ${[{ bar: [{ a: 1 }] }]} + `('given $input returns $expected, with all __typename keys removed', ({ input, expected }) => { + const actual = stripTypenames(input); + expect(actual).toEqual(expected); + expect(input).not.toBe(actual); + }); + + it('given null returns null', () => { + expect(stripTypenames(null)).toEqual(null); + }); +}); diff --git a/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js b/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js index 1a3b151afa0..0faf0db4135 100644 --- a/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js +++ b/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js @@ -2,11 +2,11 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; import Vuex from 'vuex'; import { GlModal, GlSearchBoxByType } from '@gitlab/ui'; import AddReviewItemsModal from '~/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue'; -import getDiffWithCommit from '../../diffs/mock_data/diff_with_commit'; import defaultState from '~/add_context_commits_modal/store/state'; import mutations from '~/add_context_commits_modal/store/mutations'; import * as actions from '~/add_context_commits_modal/store/actions'; +import getDiffWithCommit from '../../diffs/mock_data/diff_with_commit'; const localVue = createLocalVue(); localVue.use(Vuex); diff --git a/spec/frontend/alert_management/components/alert_metrics_spec.js b/spec/frontend/alert_management/components/alert_metrics_spec.js index 42da8c3768b..bae82c38a0d 100644 --- a/spec/frontend/alert_management/components/alert_metrics_spec.js +++ b/spec/frontend/alert_management/components/alert_metrics_spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; -import waitForPromises from 'helpers/wait_for_promises'; import MockAdapter from 'axios-mock-adapter'; import axios from 'axios'; +import waitForPromises from 'helpers/wait_for_promises'; import AlertMetrics from '~/alert_management/components/alert_metrics.vue'; import MetricEmbed from '~/monitoring/components/embeds/metric_embed.vue'; diff --git a/spec/frontend/alerts_settings/components/alerts_settings_form_spec.js b/spec/frontend/alerts_settings/components/alerts_settings_form_spec.js index 4f8983b1aca..3247f913816 100644 --- a/spec/frontend/alerts_settings/components/alerts_settings_form_spec.js +++ b/spec/frontend/alerts_settings/components/alerts_settings_form_spec.js @@ -10,8 +10,8 @@ import { import waitForPromises from 'helpers/wait_for_promises'; import AlertsSettingsForm from '~/alerts_settings/components/alerts_settings_form.vue'; import MappingBuilder from '~/alerts_settings/components/alert_mapping_builder.vue'; -import { defaultAlertSettingsConfig } from './util'; import { typeSet } from '~/alerts_settings/constants'; +import { defaultAlertSettingsConfig } from './util'; describe('AlertsSettingsFormNew', () => { let wrapper; diff --git a/spec/frontend/alerts_settings/components/alerts_settings_wrapper_spec.js b/spec/frontend/alerts_settings/components/alerts_settings_wrapper_spec.js index 4d0732ca76c..79a7cd93f01 100644 --- a/spec/frontend/alerts_settings/components/alerts_settings_wrapper_spec.js +++ b/spec/frontend/alerts_settings/components/alerts_settings_wrapper_spec.js @@ -1,10 +1,10 @@ import VueApollo from 'vue-apollo'; import { mount, createLocalVue } from '@vue/test-utils'; import AxiosMockAdapter from 'axios-mock-adapter'; +import { GlLoadingIcon } from '@gitlab/ui'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import { useMockIntersectionObserver } from 'helpers/mock_dom_observer'; -import { GlLoadingIcon } from '@gitlab/ui'; import axios from '~/lib/utils/axios_utils'; import AlertsSettingsWrapper from '~/alerts_settings/components/alerts_settings_wrapper.vue'; import AlertsSettingsForm from '~/alerts_settings/components/alerts_settings_form.vue'; diff --git a/spec/frontend/blob/components/blob_content_spec.js b/spec/frontend/blob/components/blob_content_spec.js index 3db95e5ad3f..44e2742745f 100644 --- a/spec/frontend/blob/components/blob_content_spec.js +++ b/spec/frontend/blob/components/blob_content_spec.js @@ -7,6 +7,7 @@ import { BLOB_RENDER_EVENT_SHOW_SOURCE, BLOB_RENDER_ERRORS, } from '~/blob/components/constants'; +import { RichViewer, SimpleViewer } from '~/vue_shared/components/blob_viewers'; import { Blob, RichViewerMock, @@ -14,7 +15,6 @@ import { RichBlobContentMock, SimpleBlobContentMock, } from './mock_data'; -import { RichViewer, SimpleViewer } from '~/vue_shared/components/blob_viewers'; describe('Blob Content component', () => { let wrapper; diff --git a/spec/frontend/blob/components/blob_header_filepath_spec.js b/spec/frontend/blob/components/blob_header_filepath_spec.js index 7b8b5050486..ed2d214c307 100644 --- a/spec/frontend/blob/components/blob_header_filepath_spec.js +++ b/spec/frontend/blob/components/blob_header_filepath_spec.js @@ -1,8 +1,8 @@ import { shallowMount } from '@vue/test-utils'; import BlobHeaderFilepath from '~/blob/components/blob_header_filepath.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; -import { Blob as MockBlob } from './mock_data'; import { numberToHumanSize } from '~/lib/utils/number_utils'; +import { Blob as MockBlob } from './mock_data'; jest.mock('~/lib/utils/number_utils', () => ({ numberToHumanSize: jest.fn(() => 'a lot'), diff --git a/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js b/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js index e55b8e4af24..c3e32f24d7f 100644 --- a/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js +++ b/spec/frontend/blob/suggest_gitlab_ci_yml/components/popover_spec.js @@ -1,6 +1,6 @@ import { shallowMount } from '@vue/test-utils'; -import { mockTracking, unmockTracking, triggerEvent } from 'helpers/tracking_helper'; import { GlButton } from '@gitlab/ui'; +import { mockTracking, unmockTracking, triggerEvent } from 'helpers/tracking_helper'; import Popover from '~/blob/suggest_gitlab_ci_yml/components/popover.vue'; import * as utils from '~/lib/utils/common_utils'; diff --git a/spec/frontend/boards/board_list_deprecated_spec.js b/spec/frontend/boards/board_list_deprecated_spec.js index 393d7f954b1..d1c9d648c96 100644 --- a/spec/frontend/boards/board_list_deprecated_spec.js +++ b/spec/frontend/boards/board_list_deprecated_spec.js @@ -9,9 +9,9 @@ import eventHub from '~/boards/eventhub'; import BoardList from '~/boards/components/board_list_deprecated.vue'; import '~/boards/models/issue'; import '~/boards/models/list'; -import { listObj, boardsMockInterceptor } from './mock_data'; import store from '~/boards/stores'; import boardsStore from '~/boards/stores/boards_store'; +import { listObj, boardsMockInterceptor } from './mock_data'; const createComponent = ({ done, listIssueProps = {}, componentProps = {}, listProps = {} }) => { const el = document.createElement('div'); diff --git a/spec/frontend/boards/board_list_helper.js b/spec/frontend/boards/board_list_helper.js index f82b1f7ed5c..7f0bad030fe 100644 --- a/spec/frontend/boards/board_list_helper.js +++ b/spec/frontend/boards/board_list_helper.js @@ -9,9 +9,9 @@ import BoardList from '~/boards/components/board_list_deprecated.vue'; import '~/boards/models/issue'; import '~/boards/models/list'; -import { listObj, boardsMockInterceptor } from './mock_data'; import store from '~/boards/stores'; import boardsStore from '~/boards/stores/boards_store'; +import { listObj, boardsMockInterceptor } from './mock_data'; window.Sortable = Sortable; diff --git a/spec/frontend/boards/board_list_spec.js b/spec/frontend/boards/board_list_spec.js index 1b62f25044e..05f4479959e 100644 --- a/spec/frontend/boards/board_list_spec.js +++ b/spec/frontend/boards/board_list_spec.js @@ -1,11 +1,11 @@ import Vuex from 'vuex'; -import { useFakeRequestAnimationFrame } from 'helpers/fake_request_animation_frame'; import { createLocalVue, mount } from '@vue/test-utils'; +import { useFakeRequestAnimationFrame } from 'helpers/fake_request_animation_frame'; import eventHub from '~/boards/eventhub'; import BoardList from '~/boards/components/board_list.vue'; import BoardCard from '~/boards/components/board_card.vue'; -import { mockList, mockIssuesByListId, issues, mockIssues } from './mock_data'; import defaultState from '~/boards/stores/state'; +import { mockList, mockIssuesByListId, issues, mockIssues } from './mock_data'; const localVue = createLocalVue(); localVue.use(Vuex); diff --git a/spec/frontend/boards/boards_store_spec.js b/spec/frontend/boards/boards_store_spec.js index f1d249ff069..b7a18c6c0ce 100644 --- a/spec/frontend/boards/boards_store_spec.js +++ b/spec/frontend/boards/boards_store_spec.js @@ -3,10 +3,10 @@ import { TEST_HOST } from 'helpers/test_constants'; import axios from '~/lib/utils/axios_utils'; import boardsStore from '~/boards/stores/boards_store'; import eventHub from '~/boards/eventhub'; -import { listObj, listObjDuplicate } from './mock_data'; import ListIssue from '~/boards/models/issue'; import List from '~/boards/models/list'; +import { listObj, listObjDuplicate } from './mock_data'; jest.mock('js-cookie'); diff --git a/spec/frontend/boards/components/board_assignee_dropdown_spec.js b/spec/frontend/boards/components/board_assignee_dropdown_spec.js index b7c75db542c..77d48c42d4b 100644 --- a/spec/frontend/boards/components/board_assignee_dropdown_spec.js +++ b/spec/frontend/boards/components/board_assignee_dropdown_spec.js @@ -6,8 +6,8 @@ import { GlSearchBoxByType, GlLoadingIcon, } from '@gitlab/ui'; -import createMockApollo from 'helpers/mock_apollo_helper'; import VueApollo from 'vue-apollo'; +import createMockApollo from 'helpers/mock_apollo_helper'; import BoardAssigneeDropdown from '~/boards/components/board_assignee_dropdown.vue'; import IssuableAssignees from '~/sidebar/components/assignees/issuable_assignees.vue'; import MultiSelectDropdown from '~/vue_shared/components/sidebar/multiselect_dropdown.vue'; diff --git a/spec/frontend/boards/components/board_card_layout_deprecated_spec.js b/spec/frontend/boards/components/board_card_layout_deprecated_spec.js index adeb96eb5eb..80f9c1a0545 100644 --- a/spec/frontend/boards/components/board_card_layout_deprecated_spec.js +++ b/spec/frontend/boards/components/board_card_layout_deprecated_spec.js @@ -15,9 +15,8 @@ import boardsVuexStore from '~/boards/stores'; import boardsStore from '~/boards/stores/boards_store'; import BoardCardLayout from '~/boards/components/board_card_layout_deprecated.vue'; import issueCardInner from '~/boards/components/issue_card_inner.vue'; -import { listObj, boardsMockInterceptor, setMockEndpoints } from '../mock_data'; - import { ISSUABLE } from '~/boards/constants'; +import { listObj, boardsMockInterceptor, setMockEndpoints } from '../mock_data'; describe('Board card layout', () => { let wrapper; diff --git a/spec/frontend/boards/components/board_card_layout_spec.js b/spec/frontend/boards/components/board_card_layout_spec.js index 88407c3e451..3ce3d0100f8 100644 --- a/spec/frontend/boards/components/board_card_layout_spec.js +++ b/spec/frontend/boards/components/board_card_layout_spec.js @@ -4,9 +4,8 @@ import { createLocalVue, shallowMount } from '@vue/test-utils'; import defaultState from '~/boards/stores/state'; import BoardCardLayout from '~/boards/components/board_card_layout.vue'; import IssueCardInner from '~/boards/components/issue_card_inner.vue'; -import { mockLabelList, mockIssue } from '../mock_data'; - import { ISSUABLE } from '~/boards/constants'; +import { mockLabelList, mockIssue } from '../mock_data'; describe('Board card layout', () => { let wrapper; diff --git a/spec/frontend/boards/components/board_content_spec.js b/spec/frontend/boards/components/board_content_spec.js index 98be02d7dbf..ef2795030a0 100644 --- a/spec/frontend/boards/components/board_content_spec.js +++ b/spec/frontend/boards/components/board_content_spec.js @@ -5,8 +5,8 @@ import Draggable from 'vuedraggable'; import EpicsSwimlanes from 'ee_component/boards/components/epics_swimlanes.vue'; import getters from 'ee_else_ce/boards/stores/getters'; import BoardColumnDeprecated from '~/boards/components/board_column_deprecated.vue'; -import { mockLists, mockListsWithModel } from '../mock_data'; import BoardContent from '~/boards/components/board_content.vue'; +import { mockLists, mockListsWithModel } from '../mock_data'; const localVue = createLocalVue(); localVue.use(Vuex); diff --git a/spec/frontend/boards/components/board_form_spec.js b/spec/frontend/boards/components/board_form_spec.js index c34987a55de..acff37296ce 100644 --- a/spec/frontend/boards/components/board_form_spec.js +++ b/spec/frontend/boards/components/board_form_spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; -import { TEST_HOST } from 'helpers/test_constants'; import { GlModal } from '@gitlab/ui'; +import { TEST_HOST } from 'helpers/test_constants'; import waitForPromises from 'helpers/wait_for_promises'; import { deprecatedCreateFlash as createFlash } from '~/flash'; diff --git a/spec/frontend/boards/components/sidebar/board_sidebar_subscription_spec.js b/spec/frontend/boards/components/sidebar/board_sidebar_subscription_spec.js index b1df0f2d771..8e1285dcd07 100644 --- a/spec/frontend/boards/components/sidebar/board_sidebar_subscription_spec.js +++ b/spec/frontend/boards/components/sidebar/board_sidebar_subscription_spec.js @@ -4,8 +4,8 @@ import { GlToggle, GlLoadingIcon } from '@gitlab/ui'; import BoardSidebarSubscription from '~/boards/components/sidebar/board_sidebar_subscription.vue'; import * as types from '~/boards/stores/mutation_types'; import { createStore } from '~/boards/stores'; -import { mockActiveIssue } from '../../mock_data'; import createFlash from '~/flash'; +import { mockActiveIssue } from '../../mock_data'; jest.mock('~/flash.js'); diff --git a/spec/frontend/boards/issue_card_deprecated_spec.js b/spec/frontend/boards/issue_card_deprecated_spec.js index fd7b0edb97e..2fefda5158b 100644 --- a/spec/frontend/boards/issue_card_deprecated_spec.js +++ b/spec/frontend/boards/issue_card_deprecated_spec.js @@ -7,8 +7,8 @@ import '~/boards/models/issue'; import '~/boards/models/list'; import { GlLabel } from '@gitlab/ui'; import IssueCardInner from '~/boards/components/issue_card_inner_deprecated.vue'; -import { listObj } from './mock_data'; import store from '~/boards/stores'; +import { listObj } from './mock_data'; describe('Issue card component', () => { const user = new ListAssignee({ diff --git a/spec/frontend/boards/issue_card_inner_spec.js b/spec/frontend/boards/issue_card_inner_spec.js index f9ad78494af..aa8f6b826b6 100644 --- a/spec/frontend/boards/issue_card_inner_spec.js +++ b/spec/frontend/boards/issue_card_inner_spec.js @@ -2,10 +2,10 @@ import { mount } from '@vue/test-utils'; import { range } from 'lodash'; import { GlLabel } from '@gitlab/ui'; import IssueCardInner from '~/boards/components/issue_card_inner.vue'; -import { mockLabelList } from './mock_data'; import defaultStore from '~/boards/stores'; import eventHub from '~/boards/eventhub'; import { updateHistory } from '~/lib/utils/url_utility'; +import { mockLabelList } from './mock_data'; jest.mock('~/lib/utils/url_utility'); jest.mock('~/boards/eventhub'); diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js index c285e04a042..fe78375c0b6 100644 --- a/spec/frontend/boards/stores/actions_spec.js +++ b/spec/frontend/boards/stores/actions_spec.js @@ -1,16 +1,4 @@ import testAction from 'helpers/vuex_action_helper'; -import { - mockLists, - mockListsById, - mockIssue, - mockIssue2, - rawIssue, - mockIssues, - mockMilestone, - labels, - mockActiveIssue, - mockGroupProjects, -} from '../mock_data'; import actions, { gqlClient } from '~/boards/stores/actions'; import * as types from '~/boards/stores/mutation_types'; import { inactiveId } from '~/boards/constants'; @@ -25,6 +13,18 @@ import { formatIssueInput, } from '~/boards/boards_util'; import createFlash from '~/flash'; +import { + mockLists, + mockListsById, + mockIssue, + mockIssue2, + rawIssue, + mockIssues, + mockMilestone, + labels, + mockActiveIssue, + mockGroupProjects, +} from '../mock_data'; jest.mock('~/flash'); diff --git a/spec/frontend/ci_variable_list/store/actions_spec.js b/spec/frontend/ci_variable_list/store/actions_spec.js index 075e5829305..03a2e37ed55 100644 --- a/spec/frontend/ci_variable_list/store/actions_spec.js +++ b/spec/frontend/ci_variable_list/store/actions_spec.js @@ -6,8 +6,8 @@ import { deprecatedCreateFlash as createFlash } from '~/flash'; import getInitialState from '~/ci_variable_list/store/state'; import * as actions from '~/ci_variable_list/store/actions'; import * as types from '~/ci_variable_list/store/mutation_types'; -import mockData from '../services/mock_data'; import { prepareDataForDisplay, prepareEnvironments } from '~/ci_variable_list/store/utils'; +import mockData from '../services/mock_data'; jest.mock('~/api.js'); jest.mock('~/flash.js'); diff --git a/spec/frontend/clusters/components/applications_spec.js b/spec/frontend/clusters/components/applications_spec.js index 431b042cce7..78f08430554 100644 --- a/spec/frontend/clusters/components/applications_spec.js +++ b/spec/frontend/clusters/components/applications_spec.js @@ -1,13 +1,13 @@ import { shallowMount, mount } from '@vue/test-utils'; import Applications from '~/clusters/components/applications.vue'; import { CLUSTER_TYPE, PROVIDER_TYPE } from '~/clusters/constants'; -import { APPLICATIONS_MOCK_STATE } from '../services/mock_data'; import eventHub from '~/clusters/event_hub'; import ApplicationRow from '~/clusters/components/application_row.vue'; import KnativeDomainEditor from '~/clusters/components/knative_domain_editor.vue'; import CrossplaneProviderStack from '~/clusters/components/crossplane_provider_stack.vue'; import IngressModsecuritySettings from '~/clusters/components/ingress_modsecurity_settings.vue'; import FluentdOutputSettings from '~/clusters/components/fluentd_output_settings.vue'; +import { APPLICATIONS_MOCK_STATE } from '../services/mock_data'; describe('Applications', () => { let wrapper; diff --git a/spec/frontend/clusters_list/store/actions_spec.js b/spec/frontend/clusters_list/store/actions_spec.js index 6214cb50e13..60d6bb46e3c 100644 --- a/spec/frontend/clusters_list/store/actions_spec.js +++ b/spec/frontend/clusters_list/store/actions_spec.js @@ -5,10 +5,10 @@ import * as Sentry from '~/sentry/wrapper'; import Poll from '~/lib/utils/poll'; import { deprecatedCreateFlash as flashError } from '~/flash'; import axios from '~/lib/utils/axios_utils'; -import { apiData } from '../mock_data'; import { MAX_REQUESTS } from '~/clusters_list/constants'; import * as types from '~/clusters_list/store/mutation_types'; import * as actions from '~/clusters_list/store/actions'; +import { apiData } from '../mock_data'; jest.mock('~/flash.js'); diff --git a/spec/frontend/clusters_list/store/mutations_spec.js b/spec/frontend/clusters_list/store/mutations_spec.js index df0dfe587b6..2ca1c20ad56 100644 --- a/spec/frontend/clusters_list/store/mutations_spec.js +++ b/spec/frontend/clusters_list/store/mutations_spec.js @@ -1,7 +1,7 @@ import * as types from '~/clusters_list/store/mutation_types'; -import { apiData } from '../mock_data'; import getInitialState from '~/clusters_list/store/state'; import mutations from '~/clusters_list/store/mutations'; +import { apiData } from '../mock_data'; describe('Admin statistics panel mutations', () => { let state; diff --git a/spec/frontend/create_cluster/eks_cluster/store/actions_spec.js b/spec/frontend/create_cluster/eks_cluster/store/actions_spec.js index 35348d3a03b..fd5db1c6a29 100644 --- a/spec/frontend/create_cluster/eks_cluster/store/actions_spec.js +++ b/spec/frontend/create_cluster/eks_cluster/store/actions_spec.js @@ -1,6 +1,6 @@ +import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; import { useMockLocationHelper } from 'helpers/mock_window_location_helper'; -import MockAdapter from 'axios-mock-adapter'; import createState from '~/create_cluster/eks_cluster/store/state'; import * as actions from '~/create_cluster/eks_cluster/store/actions'; import { diff --git a/spec/frontend/create_cluster/gke_cluster/components/gke_machine_type_dropdown_spec.js b/spec/frontend/create_cluster/gke_cluster/components/gke_machine_type_dropdown_spec.js index c09eaa63d4d..e97e0a6686d 100644 --- a/spec/frontend/create_cluster/gke_cluster/components/gke_machine_type_dropdown_spec.js +++ b/spec/frontend/create_cluster/gke_cluster/components/gke_machine_type_dropdown_spec.js @@ -1,10 +1,10 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; import Vuex from 'vuex'; -import { selectedMachineTypeMock, gapiMachineTypesResponseMock } from '../mock_data'; import createState from '~/create_cluster/gke_cluster/store/state'; import DropdownButton from '~/vue_shared/components/dropdown/dropdown_button.vue'; import DropdownHiddenInput from '~/vue_shared/components/dropdown/dropdown_hidden_input.vue'; import GkeMachineTypeDropdown from '~/create_cluster/gke_cluster/components/gke_machine_type_dropdown.vue'; +import { selectedMachineTypeMock, gapiMachineTypesResponseMock } from '../mock_data'; const componentConfig = { fieldId: 'cluster_provider_gcp_attributes_gcp_machine_type', diff --git a/spec/frontend/create_cluster/gke_cluster/components/gke_project_id_dropdown_spec.js b/spec/frontend/create_cluster/gke_cluster/components/gke_project_id_dropdown_spec.js index eb58108bf3c..90f96c98427 100644 --- a/spec/frontend/create_cluster/gke_cluster/components/gke_project_id_dropdown_spec.js +++ b/spec/frontend/create_cluster/gke_cluster/components/gke_project_id_dropdown_spec.js @@ -1,10 +1,10 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; import Vuex from 'vuex'; import createState from '~/create_cluster/gke_cluster/store/state'; -import { selectedProjectMock, gapiProjectsResponseMock } from '../mock_data'; import GkeProjectIdDropdown from '~/create_cluster/gke_cluster/components/gke_project_id_dropdown.vue'; import DropdownButton from '~/vue_shared/components/dropdown/dropdown_button.vue'; import DropdownHiddenInput from '~/vue_shared/components/dropdown/dropdown_hidden_input.vue'; +import { selectedProjectMock, gapiProjectsResponseMock } from '../mock_data'; const componentConfig = { docsUrl: 'https://console.cloud.google.com/home/dashboard', diff --git a/spec/frontend/design_management/components/design_notes/design_discussion_spec.js b/spec/frontend/design_management/components/design_notes/design_discussion_spec.js index 77fc70e08d1..a414eb04ab4 100644 --- a/spec/frontend/design_management/components/design_notes/design_discussion_spec.js +++ b/spec/frontend/design_management/components/design_notes/design_discussion_spec.js @@ -1,6 +1,5 @@ import { mount } from '@vue/test-utils'; import { GlLoadingIcon } from '@gitlab/ui'; -import notes from '../../mock_data/notes'; import DesignDiscussion from '~/design_management/components/design_notes/design_discussion.vue'; import DesignNote from '~/design_management/components/design_notes/design_note.vue'; import DesignReplyForm from '~/design_management/components/design_notes/design_reply_form.vue'; @@ -8,6 +7,7 @@ import createNoteMutation from '~/design_management/graphql/mutations/create_not import toggleResolveDiscussionMutation from '~/design_management/graphql/mutations/toggle_resolve_discussion.mutation.graphql'; import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue'; import ToggleRepliesWidget from '~/design_management/components/design_notes/toggle_replies_widget.vue'; +import notes from '../../mock_data/notes'; import mockDiscussion from '../../mock_data/discussion'; const defaultMockDiscussion = { diff --git a/spec/frontend/design_management/components/design_overlay_spec.js b/spec/frontend/design_management/components/design_overlay_spec.js index a026cc39c84..ecb1fdbf534 100644 --- a/spec/frontend/design_management/components/design_overlay_spec.js +++ b/spec/frontend/design_management/components/design_overlay_spec.js @@ -1,8 +1,8 @@ import { mount } from '@vue/test-utils'; import DesignOverlay from '~/design_management/components/design_overlay.vue'; import updateActiveDiscussion from '~/design_management/graphql/mutations/update_active_discussion.mutation.graphql'; -import notes from '../mock_data/notes'; import { ACTIVE_DISCUSSION_SOURCE_TYPES } from '~/design_management/constants'; +import notes from '../mock_data/notes'; const mutate = jest.fn(() => Promise.resolve()); diff --git a/spec/frontend/design_management/components/design_sidebar_spec.js b/spec/frontend/design_management/components/design_sidebar_spec.js index 60266883fcd..3d520ea721a 100644 --- a/spec/frontend/design_management/components/design_sidebar_spec.js +++ b/spec/frontend/design_management/components/design_sidebar_spec.js @@ -4,9 +4,9 @@ import Cookies from 'js-cookie'; import DesignSidebar from '~/design_management/components/design_sidebar.vue'; import Participants from '~/sidebar/components/participants/participants.vue'; import DesignDiscussion from '~/design_management/components/design_notes/design_discussion.vue'; -import design from '../mock_data/design'; import updateActiveDiscussionMutation from '~/design_management/graphql/mutations/update_active_discussion.mutation.graphql'; import DesignTodoButton from '~/design_management/components/design_todo_button.vue'; +import design from '../mock_data/design'; const scrollIntoViewMock = jest.fn(); HTMLElement.prototype.scrollIntoView = scrollIntoViewMock; diff --git a/spec/frontend/design_management/components/list/item_spec.js b/spec/frontend/design_management/components/list/item_spec.js index 35be4d9784c..a89d05127c7 100644 --- a/spec/frontend/design_management/components/list/item_spec.js +++ b/spec/frontend/design_management/components/list/item_spec.js @@ -1,7 +1,7 @@ import { createLocalVue, shallowMount } from '@vue/test-utils'; import { GlIcon, GlLoadingIcon, GlIntersectionObserver } from '@gitlab/ui'; -import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import VueRouter from 'vue-router'; +import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import Item from '~/design_management/components/list/item.vue'; const localVue = createLocalVue(); diff --git a/spec/frontend/design_management/pages/design/index_spec.js b/spec/frontend/design_management/pages/design/index_spec.js index 9c11af28cf0..63e1c712d6b 100644 --- a/spec/frontend/design_management/pages/design/index_spec.js +++ b/spec/frontend/design_management/pages/design/index_spec.js @@ -18,15 +18,15 @@ import { DESIGNS_ROUTE_NAME, DESIGN_ROUTE_NAME } from '~/design_management/route import createRouter from '~/design_management/router'; import * as utils from '~/design_management/utils/design_management_utils'; import { DESIGN_DETAIL_LAYOUT_CLASSLIST } from '~/design_management/constants'; -import design from '../../mock_data/design'; -import mockResponseWithDesigns from '../../mock_data/designs'; -import mockResponseNoDesigns from '../../mock_data/no_designs'; -import mockAllVersions from '../../mock_data/all_versions'; import { DESIGN_TRACKING_PAGE_NAME, DESIGN_SNOWPLOW_EVENT_TYPES, DESIGN_USAGE_PING_EVENT_TYPES, } from '~/design_management/utils/tracking'; +import design from '../../mock_data/design'; +import mockResponseWithDesigns from '../../mock_data/designs'; +import mockResponseNoDesigns from '../../mock_data/no_designs'; +import mockAllVersions from '../../mock_data/all_versions'; jest.mock('~/flash'); jest.mock('~/api.js'); diff --git a/spec/frontend/design_management/pages/index_spec.js b/spec/frontend/design_management/pages/index_spec.js index 7d28d6f6d11..94d75f018f9 100644 --- a/spec/frontend/design_management/pages/index_spec.js +++ b/spec/frontend/design_management/pages/index_spec.js @@ -22,6 +22,11 @@ import { import createFlash from '~/flash'; import createRouter from '~/design_management/router'; import * as utils from '~/design_management/utils/design_management_utils'; +import moveDesignMutation from '~/design_management/graphql/mutations/move_design.mutation.graphql'; +import { + DESIGN_TRACKING_PAGE_NAME, + DESIGN_SNOWPLOW_EVENT_TYPES, +} from '~/design_management/utils/tracking'; import { designListQueryResponse, designUploadMutationCreatedResponse, @@ -31,11 +36,6 @@ import { reorderedDesigns, moveDesignMutationResponseWithErrors, } from '../mock_data/apollo_mock'; -import moveDesignMutation from '~/design_management/graphql/mutations/move_design.mutation.graphql'; -import { - DESIGN_TRACKING_PAGE_NAME, - DESIGN_SNOWPLOW_EVENT_TYPES, -} from '~/design_management/utils/tracking'; jest.mock('~/flash.js'); const mockPageEl = { diff --git a/spec/frontend/design_management/utils/cache_update_spec.js b/spec/frontend/design_management/utils/cache_update_spec.js index 2fb08c3ef05..7327cf00abd 100644 --- a/spec/frontend/design_management/utils/cache_update_spec.js +++ b/spec/frontend/design_management/utils/cache_update_spec.js @@ -10,8 +10,8 @@ import { ADD_IMAGE_DIFF_NOTE_ERROR, UPDATE_IMAGE_DIFF_NOTE_ERROR, } from '~/design_management/utils/error_messages'; -import design from '../mock_data/design'; import createFlash from '~/flash'; +import design from '../mock_data/design'; jest.mock('~/flash.js'); diff --git a/spec/frontend/diffs/components/app_spec.js b/spec/frontend/diffs/components/app_spec.js index 7fbeb33dd93..e84fa6fb0ae 100644 --- a/spec/frontend/diffs/components/app_spec.js +++ b/spec/frontend/diffs/components/app_spec.js @@ -3,8 +3,8 @@ import Vuex from 'vuex'; import { shallowMount } from '@vue/test-utils'; import { GlLoadingIcon, GlPagination } from '@gitlab/ui'; import MockAdapter from 'axios-mock-adapter'; -import { TEST_HOST } from 'spec/test_constants'; import Mousetrap from 'mousetrap'; +import { TEST_HOST } from 'spec/test_constants'; import App from '~/diffs/components/app.vue'; import NoChanges from '~/diffs/components/no_changes.vue'; import DiffFile from '~/diffs/components/diff_file.vue'; @@ -13,14 +13,14 @@ import HiddenFilesWarning from '~/diffs/components/hidden_files_warning.vue'; import CollapsedFilesWarning from '~/diffs/components/collapsed_files_warning.vue'; import CommitWidget from '~/diffs/components/commit_widget.vue'; import TreeList from '~/diffs/components/tree_list.vue'; -import createDiffsStore from '../create_diffs_store'; import axios from '~/lib/utils/axios_utils'; import * as urlUtils from '~/lib/utils/url_utility'; -import diffsMockData from '../mock_data/merge_request_diffs'; import { EVT_VIEW_FILE_BY_FILE } from '~/diffs/constants'; import eventHub from '~/diffs/event_hub'; +import diffsMockData from '../mock_data/merge_request_diffs'; +import createDiffsStore from '../create_diffs_store'; const mergeRequestDiff = { version_index: 1 }; const TEST_ENDPOINT = `${TEST_HOST}/diff/endpoint`; diff --git a/spec/frontend/diffs/components/compare_versions_spec.js b/spec/frontend/diffs/components/compare_versions_spec.js index 949cc855200..adb695b8a64 100644 --- a/spec/frontend/diffs/components/compare_versions_spec.js +++ b/spec/frontend/diffs/components/compare_versions_spec.js @@ -1,6 +1,6 @@ -import { trimText } from 'helpers/text_helper'; import { mount, createLocalVue } from '@vue/test-utils'; import Vuex from 'vuex'; +import { trimText } from 'helpers/text_helper'; import CompareVersionsComponent from '~/diffs/components/compare_versions.vue'; import { createStore } from '~/mr_notes/stores'; import diffsMockData from '../mock_data/merge_request_diffs'; diff --git a/spec/frontend/diffs/components/diff_content_spec.js b/spec/frontend/diffs/components/diff_content_spec.js index c1cf4793c88..7b2b8996808 100644 --- a/spec/frontend/diffs/components/diff_content_spec.js +++ b/spec/frontend/diffs/components/diff_content_spec.js @@ -9,9 +9,9 @@ import ParallelDiffView from '~/diffs/components/parallel_diff_view.vue'; import NoteForm from '~/notes/components/note_form.vue'; import DiffDiscussions from '~/diffs/components/diff_discussions.vue'; import { IMAGE_DIFF_POSITION_TYPE } from '~/diffs/constants'; -import diffFileMockData from '../mock_data/diff_file'; import { diffViewerModes } from '~/ide/constants'; import DiffView from '~/diffs/components/diff_view.vue'; +import diffFileMockData from '../mock_data/diff_file'; const localVue = createLocalVue(); localVue.use(Vuex); diff --git a/spec/frontend/diffs/components/diff_file_header_spec.js b/spec/frontend/diffs/components/diff_file_header_spec.js index 8487a3ea818..5bd59055afc 100644 --- a/spec/frontend/diffs/components/diff_file_header_spec.js +++ b/spec/frontend/diffs/components/diff_file_header_spec.js @@ -7,17 +7,16 @@ import { mockTracking, triggerEvent } from 'helpers/tracking_helper'; import DiffFileHeader from '~/diffs/components/diff_file_header.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import FileIcon from '~/vue_shared/components/file_icon.vue'; -import diffDiscussionsMockData from '../mock_data/diff_discussions'; import { truncateSha } from '~/lib/utils/text_utility'; import { diffViewerModes } from '~/ide/constants'; import { __, sprintf } from '~/locale'; import { scrollToElement } from '~/lib/utils/common_utils'; -import testAction from '../../__helpers__/vuex_action_helper'; - import { SET_MR_FILE_REVIEWS } from '~/diffs/store/mutation_types'; import { reviewFile } from '~/diffs/store/actions'; import { DIFF_FILE_AUTOMATIC_COLLAPSE, DIFF_FILE_MANUAL_COLLAPSE } from '~/diffs/constants'; +import testAction from '../../__helpers__/vuex_action_helper'; +import diffDiscussionsMockData from '../mock_data/diff_discussions'; jest.mock('~/lib/utils/common_utils'); diff --git a/spec/frontend/diffs/components/diff_file_spec.js b/spec/frontend/diffs/components/diff_file_spec.js index 9ca466183a3..a8a1c88b0cc 100644 --- a/spec/frontend/diffs/components/diff_file_spec.js +++ b/spec/frontend/diffs/components/diff_file_spec.js @@ -6,8 +6,6 @@ import axios from '~/lib/utils/axios_utils'; import httpStatus from '~/lib/utils/http_status'; import createDiffsStore from '~/diffs/store/modules'; import createNotesStore from '~/notes/stores/modules'; -import diffFileMockDataReadable from '../mock_data/diff_file'; -import diffFileMockDataUnreadable from '../mock_data/diff_file_unreadable'; import DiffFileComponent from '~/diffs/components/diff_file.vue'; import DiffFileHeaderComponent from '~/diffs/components/diff_file_header.vue'; @@ -21,6 +19,8 @@ import { } from '~/diffs/constants'; import { diffViewerModes, diffViewerErrors } from '~/ide/constants'; +import diffFileMockDataUnreadable from '../mock_data/diff_file_unreadable'; +import diffFileMockDataReadable from '../mock_data/diff_file'; function changeViewer(store, index, { automaticallyCollapsed, manuallyCollapsed, name }) { const file = store.state.diffs.diffFiles[index]; diff --git a/spec/frontend/diffs/components/diff_row_spec.js b/spec/frontend/diffs/components/diff_row_spec.js index c06d8e78316..0bfbbc16f07 100644 --- a/spec/frontend/diffs/components/diff_row_spec.js +++ b/spec/frontend/diffs/components/diff_row_spec.js @@ -3,8 +3,8 @@ import { getByTestId, fireEvent } from '@testing-library/dom'; import Vuex from 'vuex'; import diffsModule from '~/diffs/store/modules'; import DiffRow from '~/diffs/components/diff_row.vue'; -import diffFileMockData from '../mock_data/diff_file'; import { mapParallel } from '~/diffs/components/diff_row_utils'; +import diffFileMockData from '../mock_data/diff_file'; describe('DiffRow', () => { const testLines = [ diff --git a/spec/frontend/diffs/components/inline_diff_table_row_spec.js b/spec/frontend/diffs/components/inline_diff_table_row_spec.js index 21e7d7397a0..56a5306752f 100644 --- a/spec/frontend/diffs/components/inline_diff_table_row_spec.js +++ b/spec/frontend/diffs/components/inline_diff_table_row_spec.js @@ -2,9 +2,9 @@ import { shallowMount } from '@vue/test-utils'; import { createStore } from '~/mr_notes/stores'; import InlineDiffTableRow from '~/diffs/components/inline_diff_table_row.vue'; import DiffGutterAvatars from '~/diffs/components/diff_gutter_avatars.vue'; +import { mapInline } from '~/diffs/components/diff_row_utils'; import diffFileMockData from '../mock_data/diff_file'; import discussionsMockData from '../mock_data/diff_discussions'; -import { mapInline } from '~/diffs/components/diff_row_utils'; const TEST_USER_ID = 'abc123'; const TEST_USER = { id: TEST_USER_ID }; diff --git a/spec/frontend/diffs/components/parallel_diff_table_row_spec.js b/spec/frontend/diffs/components/parallel_diff_table_row_spec.js index 445553706b7..51c4c4ae9d6 100644 --- a/spec/frontend/diffs/components/parallel_diff_table_row_spec.js +++ b/spec/frontend/diffs/components/parallel_diff_table_row_spec.js @@ -4,8 +4,8 @@ import { createComponentWithStore } from 'helpers/vue_mount_component_helper'; import { createStore } from '~/mr_notes/stores'; import ParallelDiffTableRow from '~/diffs/components/parallel_diff_table_row.vue'; import { mapParallel } from '~/diffs/components/diff_row_utils'; -import diffFileMockData from '../mock_data/diff_file'; import DiffGutterAvatars from '~/diffs/components/diff_gutter_avatars.vue'; +import diffFileMockData from '../mock_data/diff_file'; import discussionsMockData from '../mock_data/diff_discussions'; describe('ParallelDiffTableRow', () => { diff --git a/spec/frontend/diffs/store/actions_spec.js b/spec/frontend/diffs/store/actions_spec.js index 056ac23fcf7..c204648337a 100644 --- a/spec/frontend/diffs/store/actions_spec.js +++ b/spec/frontend/diffs/store/actions_spec.js @@ -58,8 +58,8 @@ import axios from '~/lib/utils/axios_utils'; import * as utils from '~/diffs/store/utils'; import * as commonUtils from '~/lib/utils/common_utils'; import { mergeUrlParams } from '~/lib/utils/url_utility'; -import { diffMetadata } from '../mock_data/diff_metadata'; import { deprecatedCreateFlash as createFlash } from '~/flash'; +import { diffMetadata } from '../mock_data/diff_metadata'; jest.mock('~/flash'); diff --git a/spec/frontend/diffs/store/mutations_spec.js b/spec/frontend/diffs/store/mutations_spec.js index 2c342d8e2a5..e0fefc4e053 100644 --- a/spec/frontend/diffs/store/mutations_spec.js +++ b/spec/frontend/diffs/store/mutations_spec.js @@ -2,8 +2,8 @@ import createState from '~/diffs/store/modules/diff_state'; import mutations from '~/diffs/store/mutations'; import * as types from '~/diffs/store/mutation_types'; import { INLINE_DIFF_VIEW_TYPE, INLINE_DIFF_LINES_KEY } from '~/diffs/constants'; -import diffFileMockData from '../mock_data/diff_file'; import * as utils from '~/diffs/store/utils'; +import diffFileMockData from '../mock_data/diff_file'; describe('DiffsStoreMutations', () => { describe('SET_BASE_CONFIG', () => { diff --git a/spec/frontend/environments/environment_actions_spec.js b/spec/frontend/environments/environment_actions_spec.js index 875a01c07ea..279b275eb58 100644 --- a/spec/frontend/environments/environment_actions_spec.js +++ b/spec/frontend/environments/environment_actions_spec.js @@ -1,6 +1,6 @@ import { shallowMount, mount } from '@vue/test-utils'; -import { TEST_HOST } from 'helpers/test_constants'; import { GlDropdown, GlDropdownItem, GlLoadingIcon, GlIcon } from '@gitlab/ui'; +import { TEST_HOST } from 'helpers/test_constants'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import eventHub from '~/environments/event_hub'; import EnvironmentActions from '~/environments/components/environment_actions.vue'; diff --git a/spec/frontend/error_tracking/components/error_tracking_list_spec.js b/spec/frontend/error_tracking/components/error_tracking_list_spec.js index da12237b1d9..d41233a6b72 100644 --- a/spec/frontend/error_tracking/components/error_tracking_list_spec.js +++ b/spec/frontend/error_tracking/components/error_tracking_list_spec.js @@ -5,8 +5,8 @@ import stubChildren from 'helpers/stub_children'; import ErrorTrackingList from '~/error_tracking/components/error_tracking_list.vue'; import ErrorTrackingActions from '~/error_tracking/components/error_tracking_actions.vue'; import { trackErrorListViewsOptions, trackErrorStatusUpdateOptions } from '~/error_tracking/utils'; -import errorsList from './list_mock.json'; import Tracking from '~/tracking'; +import errorsList from './list_mock.json'; const localVue = createLocalVue(); localVue.use(Vuex); diff --git a/spec/frontend/frequent_items/components/app_spec.js b/spec/frontend/frequent_items/components/app_spec.js index b74e4ac45cf..5b1d397ec0b 100644 --- a/spec/frontend/frequent_items/components/app_spec.js +++ b/spec/frontend/frequent_items/components/app_spec.js @@ -8,8 +8,8 @@ import appComponent from '~/frequent_items/components/app.vue'; import eventHub from '~/frequent_items/event_hub'; import { FREQUENT_ITEMS, HOUR_IN_MS } from '~/frequent_items/constants'; import { getTopFrequentItems } from '~/frequent_items/utils'; -import { currentSession, mockFrequentProjects, mockSearchedProjects } from '../mock_data'; import { createStore } from '~/frequent_items/store'; +import { currentSession, mockFrequentProjects, mockSearchedProjects } from '../mock_data'; useLocalStorageSpy(); diff --git a/spec/frontend/frequent_items/store/actions_spec.js b/spec/frontend/frequent_items/store/actions_spec.js index 351fde25f49..acea46eae60 100644 --- a/spec/frontend/frequent_items/store/actions_spec.js +++ b/spec/frontend/frequent_items/store/actions_spec.js @@ -1,5 +1,5 @@ -import testAction from 'helpers/vuex_action_helper'; import MockAdapter from 'axios-mock-adapter'; +import testAction from 'helpers/vuex_action_helper'; import axios from '~/lib/utils/axios_utils'; import AccessorUtilities from '~/lib/utils/accessor'; import * as actions from '~/frequent_items/store/actions'; diff --git a/spec/frontend/gfm_auto_complete_spec.js b/spec/frontend/gfm_auto_complete_spec.js index 4923113ce03..aefd465532a 100644 --- a/spec/frontend/gfm_auto_complete_spec.js +++ b/spec/frontend/gfm_auto_complete_spec.js @@ -1,16 +1,13 @@ /* eslint no-param-reassign: "off" */ import $ from 'jquery'; +import MockAdapter from 'axios-mock-adapter'; import { emojiFixtureMap, initEmojiMock, describeEmojiFields } from 'helpers/emoji'; import '~/lib/utils/jquery_at_who'; import GfmAutoComplete, { membersBeforeSave } from 'ee_else_ce/gfm_auto_complete'; - import { TEST_HOST } from 'helpers/test_constants'; import { getJSONFixture } from 'helpers/fixtures'; - import waitForPromises from 'helpers/wait_for_promises'; - -import MockAdapter from 'axios-mock-adapter'; import AjaxCache from '~/lib/utils/ajax_cache'; import axios from '~/lib/utils/axios_utils'; diff --git a/spec/frontend/ide/components/preview/navigator_spec.js b/spec/frontend/ide/components/preview/navigator_spec.js index ba5ac3bbbea..e3272734755 100644 --- a/spec/frontend/ide/components/preview/navigator_spec.js +++ b/spec/frontend/ide/components/preview/navigator_spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; -import { TEST_HOST } from 'helpers/test_constants'; import { GlLoadingIcon } from '@gitlab/ui'; import { listen } from 'codesandbox-api'; +import { TEST_HOST } from 'helpers/test_constants'; import ClientsideNavigator from '~/ide/components/preview/navigator.vue'; jest.mock('codesandbox-api', () => ({ diff --git a/spec/frontend/ide/lib/decorations/controller_spec.js b/spec/frontend/ide/lib/decorations/controller_spec.js index e9b7faaadfe..2790563fd6a 100644 --- a/spec/frontend/ide/lib/decorations/controller_spec.js +++ b/spec/frontend/ide/lib/decorations/controller_spec.js @@ -1,8 +1,8 @@ import Editor from '~/ide/lib/editor'; import DecorationsController from '~/ide/lib/decorations/controller'; import Model from '~/ide/lib/common/model'; -import { file } from '../../helpers'; import { createStore } from '~/ide/stores'; +import { file } from '../../helpers'; describe('Multi-file editor library decorations controller', () => { let editorInstance; diff --git a/spec/frontend/ide/stores/actions_spec.js b/spec/frontend/ide/stores/actions_spec.js index 036bc91cd11..d925e9a0844 100644 --- a/spec/frontend/ide/stores/actions_spec.js +++ b/spec/frontend/ide/stores/actions_spec.js @@ -20,8 +20,8 @@ import { } from '~/ide/stores/actions'; import axios from '~/lib/utils/axios_utils'; import * as types from '~/ide/stores/mutation_types'; -import { file, createTriggerRenameAction, createTriggerChangeAction } from '../helpers'; import eventHub from '~/ide/eventhub'; +import { file, createTriggerRenameAction, createTriggerChangeAction } from '../helpers'; jest.mock('~/lib/utils/url_utility', () => ({ visitUrl: jest.fn(), diff --git a/spec/frontend/ide/stores/modules/commit/actions_spec.js b/spec/frontend/ide/stores/modules/commit/actions_spec.js index 24dca660d50..ac495a657a2 100644 --- a/spec/frontend/ide/stores/modules/commit/actions_spec.js +++ b/spec/frontend/ide/stores/modules/commit/actions_spec.js @@ -1,6 +1,6 @@ -import { file } from 'jest/ide/helpers'; import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; +import { file } from 'jest/ide/helpers'; import testAction from 'helpers/vuex_action_helper'; import { visitUrl } from '~/lib/utils/url_utility'; import { createStore } from '~/ide/stores'; diff --git a/spec/frontend/incidents_settings/components/pagerduty_form_spec.js b/spec/frontend/incidents_settings/components/pagerduty_form_spec.js index 50d0de8a753..0d98c09e16f 100644 --- a/spec/frontend/incidents_settings/components/pagerduty_form_spec.js +++ b/spec/frontend/incidents_settings/components/pagerduty_form_spec.js @@ -1,6 +1,6 @@ import { shallowMount } from '@vue/test-utils'; -import waitForPromises from 'helpers/wait_for_promises'; import { GlAlert, GlModal } from '@gitlab/ui'; +import waitForPromises from 'helpers/wait_for_promises'; import PagerDutySettingsForm from '~/incidents_settings/components/pagerduty_form.vue'; describe('Alert integration settings form', () => { diff --git a/spec/frontend/issue_show/components/app_spec.js b/spec/frontend/issue_show/components/app_spec.js index ec2055ca7d1..9be45686d91 100644 --- a/spec/frontend/issue_show/components/app_spec.js +++ b/spec/frontend/issue_show/components/app_spec.js @@ -7,6 +7,10 @@ import { visitUrl } from '~/lib/utils/url_utility'; import '~/behaviors/markdown/render_gfm'; import IssuableApp from '~/issue_show/components/app.vue'; import eventHub from '~/issue_show/event_hub'; +import IncidentTabs from '~/issue_show/components/incidents/incident_tabs.vue'; +import DescriptionComponent from '~/issue_show/components/description.vue'; +import PinnedLinks from '~/issue_show/components/pinned_links.vue'; +import { IssuableStatus, IssuableStatusText } from '~/issue_show/constants'; import { appProps, initialRequest, @@ -14,10 +18,6 @@ import { secondRequest, zoomMeetingUrl, } from '../mock_data'; -import IncidentTabs from '~/issue_show/components/incidents/incident_tabs.vue'; -import DescriptionComponent from '~/issue_show/components/description.vue'; -import PinnedLinks from '~/issue_show/components/pinned_links.vue'; -import { IssuableStatus, IssuableStatusText } from '~/issue_show/constants'; function formatText(text) { return text.trim().replace(/\s\s+/g, ' '); diff --git a/spec/frontend/issue_show/components/incidents/incident_tabs_spec.js b/spec/frontend/issue_show/components/incidents/incident_tabs_spec.js index 416870d1408..ef825688b69 100644 --- a/spec/frontend/issue_show/components/incidents/incident_tabs_spec.js +++ b/spec/frontend/issue_show/components/incidents/incident_tabs_spec.js @@ -4,12 +4,12 @@ import { GlTab } from '@gitlab/ui'; import waitForPromises from 'helpers/wait_for_promises'; import INVALID_URL from '~/lib/utils/invalid_url'; import IncidentTabs from '~/issue_show/components/incidents/incident_tabs.vue'; -import { descriptionProps } from '../../mock_data'; import DescriptionComponent from '~/issue_show/components/description.vue'; import HighlightBar from '~/issue_show/components/incidents/highlight_bar.vue'; import AlertDetailsTable from '~/vue_shared/components/alert_details_table.vue'; import Tracking from '~/tracking'; import { trackIncidentDetailsViewsOptions } from '~/incidents/constants'; +import { descriptionProps } from '../../mock_data'; const mockAlert = { __typename: 'AlertManagementAlert', diff --git a/spec/frontend/issue_show/issue_spec.js b/spec/frontend/issue_show/issue_spec.js index 818f501882b..51f3a580e6e 100644 --- a/spec/frontend/issue_show/issue_spec.js +++ b/spec/frontend/issue_show/issue_spec.js @@ -4,8 +4,8 @@ import waitForPromises from 'helpers/wait_for_promises'; import axios from '~/lib/utils/axios_utils'; import { initIssuableApp } from '~/issue_show/issue'; import * as parseData from '~/issue_show/utils/parse_data'; -import { appProps } from './mock_data'; import createStore from '~/notes/stores'; +import { appProps } from './mock_data'; const mock = new MockAdapter(axios); mock.onGet().reply(200); diff --git a/spec/frontend/issues_list/components/issuable_spec.js b/spec/frontend/issues_list/components/issuable_spec.js index b47a84ad7f6..dcc3542e905 100644 --- a/spec/frontend/issues_list/components/issuable_spec.js +++ b/spec/frontend/issues_list/components/issuable_spec.js @@ -7,8 +7,8 @@ import { formatDate } from '~/lib/utils/datetime_utility'; import { mergeUrlParams } from '~/lib/utils/url_utility'; import Issuable from '~/issues_list/components/issuable.vue'; import IssueAssignees from '~/vue_shared/components/issue/issue_assignees.vue'; -import { simpleIssue, testAssignees, testLabels } from '../issuable_list_test_data'; import { isScopedLabel } from '~/lib/utils/common_utils'; +import { simpleIssue, testAssignees, testLabels } from '../issuable_list_test_data'; jest.mock('~/user_popovers'); diff --git a/spec/frontend/jira_connect/components/app_spec.js b/spec/frontend/jira_connect/components/app_spec.js index 03f5a7c7dda..a9194cfc883 100644 --- a/spec/frontend/jira_connect/components/app_spec.js +++ b/spec/frontend/jira_connect/components/app_spec.js @@ -1,6 +1,6 @@ import { shallowMount } from '@vue/test-utils'; -import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { GlAlert, GlButton, GlModal } from '@gitlab/ui'; +import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import JiraConnectApp from '~/jira_connect/components/app.vue'; import createStore from '~/jira_connect/store'; diff --git a/spec/frontend/jira_connect/components/groups_list_item_spec.js b/spec/frontend/jira_connect/components/groups_list_item_spec.js index d7aef6932f4..2499be1ea5f 100644 --- a/spec/frontend/jira_connect/components/groups_list_item_spec.js +++ b/spec/frontend/jira_connect/components/groups_list_item_spec.js @@ -3,10 +3,9 @@ import { GlAvatar, GlButton } from '@gitlab/ui'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import { mockGroup1 } from '../mock_data'; - import GroupsListItem from '~/jira_connect/components/groups_list_item.vue'; import * as JiraConnectApi from '~/jira_connect/api'; +import { mockGroup1 } from '../mock_data'; describe('GroupsListItem', () => { let wrapper; diff --git a/spec/frontend/jobs/components/job_sidebar_retry_button_spec.js b/spec/frontend/jobs/components/job_sidebar_retry_button_spec.js index 4bf697ab7cc..8fc5b071e54 100644 --- a/spec/frontend/jobs/components/job_sidebar_retry_button_spec.js +++ b/spec/frontend/jobs/components/job_sidebar_retry_button_spec.js @@ -1,8 +1,8 @@ import { GlButton, GlLink } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import job from '../mock_data'; import JobsSidebarRetryButton from '~/jobs/components/job_sidebar_retry_button.vue'; import createStore from '~/jobs/store'; +import job from '../mock_data'; describe('Job Sidebar Retry Button', () => { let store; diff --git a/spec/frontend/logs/components/log_advanced_filters_spec.js b/spec/frontend/logs/components/log_advanced_filters_spec.js index dfa8913a301..1fc8d943215 100644 --- a/spec/frontend/logs/components/log_advanced_filters_spec.js +++ b/spec/frontend/logs/components/log_advanced_filters_spec.js @@ -4,9 +4,8 @@ import { defaultTimeRange } from '~/vue_shared/constants'; import { convertToFixedRange } from '~/lib/utils/datetime_range'; import { createStore } from '~/logs/stores'; import { TOKEN_TYPE_POD_NAME } from '~/logs/constants'; -import { mockPods, mockSearch } from '../mock_data'; - import LogAdvancedFilters from '~/logs/components/log_advanced_filters.vue'; +import { mockPods, mockSearch } from '../mock_data'; const module = 'environmentLogs'; diff --git a/spec/frontend/logs/components/log_simple_filters_spec.js b/spec/frontend/logs/components/log_simple_filters_spec.js index 5bd42fd7dbc..5d2b22da3b5 100644 --- a/spec/frontend/logs/components/log_simple_filters_spec.js +++ b/spec/frontend/logs/components/log_simple_filters_spec.js @@ -1,9 +1,8 @@ import { GlDropdownItem } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import { createStore } from '~/logs/stores'; -import { mockPods, mockPodName } from '../mock_data'; - import LogSimpleFilters from '~/logs/components/log_simple_filters.vue'; +import { mockPods, mockPodName } from '../mock_data'; const module = 'environmentLogs'; diff --git a/spec/frontend/logs/stores/actions_spec.js b/spec/frontend/logs/stores/actions_spec.js index bc58f1e677f..471b8603a94 100644 --- a/spec/frontend/logs/stores/actions_spec.js +++ b/spec/frontend/logs/stores/actions_spec.js @@ -19,6 +19,7 @@ import { defaultTimeRange } from '~/vue_shared/constants'; import axios from '~/lib/utils/axios_utils'; import { deprecatedCreateFlash as flash } from '~/flash'; +import { TOKEN_TYPE_POD_NAME } from '~/logs/constants'; import { mockPodName, mockEnvironmentsEndpoint, @@ -34,7 +35,6 @@ import { mockManagedApps, mockManagedAppsEndpoint, } from '../mock_data'; -import { TOKEN_TYPE_POD_NAME } from '~/logs/constants'; jest.mock('~/flash'); jest.mock('~/lib/utils/datetime_range'); diff --git a/spec/frontend/members/components/avatars/group_avatar_spec.js b/spec/frontend/members/components/avatars/group_avatar_spec.js index 658bb9462b0..2720181aeb8 100644 --- a/spec/frontend/members/components/avatars/group_avatar_spec.js +++ b/spec/frontend/members/components/avatars/group_avatar_spec.js @@ -1,8 +1,8 @@ import { mount, createWrapper } from '@vue/test-utils'; import { getByText as getByTextHelper } from '@testing-library/dom'; import { GlAvatarLink } from '@gitlab/ui'; -import { group as member } from '../../mock_data'; import GroupAvatar from '~/members/components/avatars/group_avatar.vue'; +import { group as member } from '../../mock_data'; describe('MemberList', () => { let wrapper; diff --git a/spec/frontend/members/components/avatars/invite_avatar_spec.js b/spec/frontend/members/components/avatars/invite_avatar_spec.js index 13ee727528b..8ebfdf31127 100644 --- a/spec/frontend/members/components/avatars/invite_avatar_spec.js +++ b/spec/frontend/members/components/avatars/invite_avatar_spec.js @@ -1,7 +1,7 @@ import { mount, createWrapper } from '@vue/test-utils'; import { getByText as getByTextHelper } from '@testing-library/dom'; -import { invite as member } from '../../mock_data'; import InviteAvatar from '~/members/components/avatars/invite_avatar.vue'; +import { invite as member } from '../../mock_data'; describe('MemberList', () => { let wrapper; diff --git a/spec/frontend/members/components/avatars/user_avatar_spec.js b/spec/frontend/members/components/avatars/user_avatar_spec.js index 411ec1a54de..d6305652616 100644 --- a/spec/frontend/members/components/avatars/user_avatar_spec.js +++ b/spec/frontend/members/components/avatars/user_avatar_spec.js @@ -1,8 +1,8 @@ import { mount, createWrapper } from '@vue/test-utils'; import { within } from '@testing-library/dom'; import { GlAvatarLink, GlBadge } from '@gitlab/ui'; -import { member as memberMock, orphanedMember } from '../../mock_data'; import UserAvatar from '~/members/components/avatars/user_avatar.vue'; +import { member as memberMock, orphanedMember } from '../../mock_data'; describe('UserAvatar', () => { let wrapper; diff --git a/spec/frontend/members/components/table/member_action_buttons_spec.js b/spec/frontend/members/components/table/member_action_buttons_spec.js index b7a6df3d054..064c8403423 100644 --- a/spec/frontend/members/components/table/member_action_buttons_spec.js +++ b/spec/frontend/members/components/table/member_action_buttons_spec.js @@ -1,11 +1,11 @@ import { shallowMount } from '@vue/test-utils'; import { MEMBER_TYPES } from '~/members/constants'; -import { member as memberMock, group, invite, accessRequest } from '../../mock_data'; import MemberActionButtons from '~/members/components/table/member_action_buttons.vue'; import UserActionButtons from '~/members/components/action_buttons/user_action_buttons.vue'; import GroupActionButtons from '~/members/components/action_buttons/group_action_buttons.vue'; import InviteActionButtons from '~/members/components/action_buttons/invite_action_buttons.vue'; import AccessRequestActionButtons from '~/members/components/action_buttons/access_request_action_buttons.vue'; +import { member as memberMock, group, invite, accessRequest } from '../../mock_data'; describe('MemberActionButtons', () => { let wrapper; diff --git a/spec/frontend/members/components/table/member_avatar_spec.js b/spec/frontend/members/components/table/member_avatar_spec.js index 4341dfbbaf9..a6f9f157532 100644 --- a/spec/frontend/members/components/table/member_avatar_spec.js +++ b/spec/frontend/members/components/table/member_avatar_spec.js @@ -1,10 +1,10 @@ import { shallowMount } from '@vue/test-utils'; import { MEMBER_TYPES } from '~/members/constants'; -import { member as memberMock, group, invite, accessRequest } from '../../mock_data'; import MemberAvatar from '~/members/components/table/member_avatar.vue'; import UserAvatar from '~/members/components/avatars/user_avatar.vue'; import GroupAvatar from '~/members/components/avatars/group_avatar.vue'; import InviteAvatar from '~/members/components/avatars/invite_avatar.vue'; +import { member as memberMock, group, invite, accessRequest } from '../../mock_data'; describe('MemberList', () => { let wrapper; diff --git a/spec/frontend/members/components/table/members_table_cell_spec.js b/spec/frontend/members/components/table/members_table_cell_spec.js index 30e6013aab2..69795a4d670 100644 --- a/spec/frontend/members/components/table/members_table_cell_spec.js +++ b/spec/frontend/members/components/table/members_table_cell_spec.js @@ -1,6 +1,7 @@ import { mount, createLocalVue } from '@vue/test-utils'; import Vuex from 'vuex'; import { MEMBER_TYPES } from '~/members/constants'; +import MembersTableCell from '~/members/components/table/members_table_cell.vue'; import { member as memberMock, directMember, @@ -9,7 +10,6 @@ import { invite, accessRequest, } from '../../mock_data'; -import MembersTableCell from '~/members/components/table/members_table_cell.vue'; describe('MembersTableCell', () => { const WrappedComponent = { diff --git a/spec/frontend/milestones/milestone_combobox_spec.js b/spec/frontend/milestones/milestone_combobox_spec.js index 8c519abe382..b0061189a48 100644 --- a/spec/frontend/milestones/milestone_combobox_spec.js +++ b/spec/frontend/milestones/milestone_combobox_spec.js @@ -6,8 +6,8 @@ import MockAdapter from 'axios-mock-adapter'; import { GlLoadingIcon, GlSearchBoxByType, GlDropdownItem } from '@gitlab/ui'; import { ENTER_KEY } from '~/lib/utils/keys'; import MilestoneCombobox from '~/milestones/components/milestone_combobox.vue'; -import { projectMilestones, groupMilestones } from './mock_data'; import createStore from '~/milestones/stores/'; +import { projectMilestones, groupMilestones } from './mock_data'; const extraLinks = [ { text: 'Create new', url: 'http://127.0.0.1:3000/h5bp/html5-boilerplate/-/milestones/new' }, diff --git a/spec/frontend/monitoring/components/charts/anomaly_spec.js b/spec/frontend/monitoring/components/charts/anomaly_spec.js index dad3003d536..00e843722d6 100644 --- a/spec/frontend/monitoring/components/charts/anomaly_spec.js +++ b/spec/frontend/monitoring/components/charts/anomaly_spec.js @@ -3,9 +3,9 @@ import { TEST_HOST } from 'helpers/test_constants'; import Anomaly from '~/monitoring/components/charts/anomaly.vue'; import { colorValues } from '~/monitoring/constants'; +import MonitorTimeSeriesChart from '~/monitoring/components/charts/time_series.vue'; import { anomalyDeploymentData, mockProjectDir } from '../../mock_data'; import { anomalyGraphData } from '../../graph_data'; -import MonitorTimeSeriesChart from '~/monitoring/components/charts/time_series.vue'; const mockProjectPath = `${TEST_HOST}${mockProjectDir}`; diff --git a/spec/frontend/monitoring/components/charts/time_series_spec.js b/spec/frontend/monitoring/components/charts/time_series_spec.js index b7e1cb91987..89b7e82e84a 100644 --- a/spec/frontend/monitoring/components/charts/time_series_spec.js +++ b/spec/frontend/monitoring/components/charts/time_series_spec.js @@ -1,14 +1,14 @@ import { mount, shallowMount } from '@vue/test-utils'; -import { setTestTimeout } from 'helpers/timeout'; import timezoneMock from 'timezone-mock'; import { GlLink } from '@gitlab/ui'; -import { TEST_HOST } from 'helpers/test_constants'; import { GlAreaChart, GlLineChart, GlChartSeriesLabel, GlChartLegend, } from '@gitlab/ui/dist/charts'; +import { TEST_HOST } from 'helpers/test_constants'; +import { setTestTimeout } from 'helpers/timeout'; import { shallowWrapperContainsSlotText } from 'helpers/vue_test_utils_helper'; import { panelTypes, chartHeight } from '~/monitoring/constants'; import TimeSeries from '~/monitoring/components/charts/time_series.vue'; diff --git a/spec/frontend/monitoring/components/dashboard_actions_menu_spec.js b/spec/frontend/monitoring/components/dashboard_actions_menu_spec.js index 43d5937a3a1..7a2f4a3de9a 100644 --- a/spec/frontend/monitoring/components/dashboard_actions_menu_spec.js +++ b/spec/frontend/monitoring/components/dashboard_actions_menu_spec.js @@ -2,13 +2,13 @@ import { shallowMount } from '@vue/test-utils'; import { GlDropdownItem } from '@gitlab/ui'; import { createStore } from '~/monitoring/stores'; import { DASHBOARD_PAGE, PANEL_NEW_PAGE } from '~/monitoring/router/constants'; -import { setupAllDashboards, setupStoreWithData } from '../store_utils'; import { redirectTo } from '~/lib/utils/url_utility'; import Tracking from '~/tracking'; import ActionsMenu from '~/monitoring/components/dashboard_actions_menu.vue'; import CustomMetricsFormFields from '~/custom_metrics/components/custom_metrics_form_fields.vue'; -import { dashboardActionsMenuProps, dashboardGitResponse } from '../mock_data'; import * as types from '~/monitoring/stores/mutation_types'; +import { dashboardActionsMenuProps, dashboardGitResponse } from '../mock_data'; +import { setupAllDashboards, setupStoreWithData } from '../store_utils'; jest.mock('~/lib/utils/url_utility', () => ({ redirectTo: jest.fn(), diff --git a/spec/frontend/monitoring/components/dashboard_header_spec.js b/spec/frontend/monitoring/components/dashboard_header_spec.js index 32fd9c45e8d..e431b17a965 100644 --- a/spec/frontend/monitoring/components/dashboard_header_spec.js +++ b/spec/frontend/monitoring/components/dashboard_header_spec.js @@ -7,6 +7,7 @@ import RefreshButton from '~/monitoring/components/refresh_button.vue'; import DashboardHeader from '~/monitoring/components/dashboard_header.vue'; import DashboardsDropdown from '~/monitoring/components/dashboards_dropdown.vue'; import ActionsMenu from '~/monitoring/components/dashboard_actions_menu.vue'; +import { redirectTo } from '~/lib/utils/url_utility'; import { setupAllDashboards, setupStoreWithDashboard, setupStoreWithData } from '../store_utils'; import { environmentData, @@ -14,7 +15,6 @@ import { selfMonitoringDashboardGitResponse, dashboardHeaderProps, } from '../mock_data'; -import { redirectTo } from '~/lib/utils/url_utility'; const mockProjectPath = 'https://path/to/project'; diff --git a/spec/frontend/monitoring/components/dashboard_panel_builder_spec.js b/spec/frontend/monitoring/components/dashboard_panel_builder_spec.js index 08c69701bd2..37939a11c4d 100644 --- a/spec/frontend/monitoring/components/dashboard_panel_builder_spec.js +++ b/spec/frontend/monitoring/components/dashboard_panel_builder_spec.js @@ -3,11 +3,10 @@ import { GlCard, GlForm, GlFormTextarea, GlAlert } from '@gitlab/ui'; import { createStore } from '~/monitoring/stores'; import DashboardPanel from '~/monitoring/components/dashboard_panel.vue'; import * as types from '~/monitoring/stores/mutation_types'; -import { metricsDashboardResponse } from '../fixture_data'; -import { mockTimeRange } from '../mock_data'; - import DashboardPanelBuilder from '~/monitoring/components/dashboard_panel_builder.vue'; import DateTimePicker from '~/vue_shared/components/date_time_picker/date_time_picker.vue'; +import { metricsDashboardResponse } from '../fixture_data'; +import { mockTimeRange } from '../mock_data'; const mockPanel = metricsDashboardResponse.dashboard.panel_groups[0].panels[0]; diff --git a/spec/frontend/monitoring/components/dashboard_panel_spec.js b/spec/frontend/monitoring/components/dashboard_panel_spec.js index f64e05d3a2c..b3257f66cc5 100644 --- a/spec/frontend/monitoring/components/dashboard_panel_spec.js +++ b/spec/frontend/monitoring/components/dashboard_panel_spec.js @@ -1,28 +1,13 @@ import Vuex from 'vuex'; import { shallowMount } from '@vue/test-utils'; import AxiosMockAdapter from 'axios-mock-adapter'; -import { setTestTimeout } from 'helpers/timeout'; import { GlDropdownItem } from '@gitlab/ui'; +import { setTestTimeout } from 'helpers/timeout'; import invalidUrl from '~/lib/utils/invalid_url'; import axios from '~/lib/utils/axios_utils'; import AlertWidget from '~/monitoring/components/alert_widget.vue'; import DashboardPanel from '~/monitoring/components/dashboard_panel.vue'; -import { - mockAlert, - mockLogsHref, - mockLogsPath, - mockNamespace, - mockNamespacedData, - mockTimeRange, -} from '../mock_data'; -import { dashboardProps, graphData, graphDataEmpty } from '../fixture_data'; -import { - anomalyGraphData, - singleStatGraphData, - heatmapGraphData, - barGraphData, -} from '../graph_data'; import { panelTypes } from '~/monitoring/constants'; @@ -37,6 +22,21 @@ import MonitorStackedColumnChart from '~/monitoring/components/charts/stacked_co import { createStore, monitoringDashboard } from '~/monitoring/stores'; import { createStore as createEmbedGroupStore } from '~/monitoring/stores/embed_group'; +import { + anomalyGraphData, + singleStatGraphData, + heatmapGraphData, + barGraphData, +} from '../graph_data'; +import { dashboardProps, graphData, graphDataEmpty } from '../fixture_data'; +import { + mockAlert, + mockLogsHref, + mockLogsPath, + mockNamespace, + mockNamespacedData, + mockTimeRange, +} from '../mock_data'; const mocks = { $toast: { diff --git a/spec/frontend/monitoring/components/dashboard_spec.js b/spec/frontend/monitoring/components/dashboard_spec.js index db35f1cdde3..062a87c4091 100644 --- a/spec/frontend/monitoring/components/dashboard_spec.js +++ b/spec/frontend/monitoring/components/dashboard_spec.js @@ -16,6 +16,7 @@ import GraphGroup from '~/monitoring/components/graph_group.vue'; import LinksSection from '~/monitoring/components/links_section.vue'; import { createStore } from '~/monitoring/stores'; import * as types from '~/monitoring/stores/mutation_types'; +import { deprecatedCreateFlash as createFlash } from '~/flash'; import { setupAllDashboards, setupStoreWithDashboard, @@ -30,7 +31,6 @@ import { metricsDashboardPanelCount, dashboardProps, } from '../fixture_data'; -import { deprecatedCreateFlash as createFlash } from '~/flash'; jest.mock('~/flash'); diff --git a/spec/frontend/monitoring/components/dashboard_url_time_spec.js b/spec/frontend/monitoring/components/dashboard_url_time_spec.js index c4630bde32f..40610e5f542 100644 --- a/spec/frontend/monitoring/components/dashboard_url_time_spec.js +++ b/spec/frontend/monitoring/components/dashboard_url_time_spec.js @@ -9,13 +9,13 @@ import { updateHistory, } from '~/lib/utils/url_utility'; import axios from '~/lib/utils/axios_utils'; -import { mockProjectDir } from '../mock_data'; -import { dashboardProps } from '../fixture_data'; import Dashboard from '~/monitoring/components/dashboard.vue'; import DashboardHeader from '~/monitoring/components/dashboard_header.vue'; import { createStore } from '~/monitoring/stores'; import { defaultTimeRange } from '~/vue_shared/constants'; +import { dashboardProps } from '../fixture_data'; +import { mockProjectDir } from '../mock_data'; jest.mock('~/flash'); jest.mock('~/lib/utils/url_utility'); diff --git a/spec/frontend/monitoring/csv_export_spec.js b/spec/frontend/monitoring/csv_export_spec.js index eb2a6e40243..42d19c21a7b 100644 --- a/spec/frontend/monitoring/csv_export_spec.js +++ b/spec/frontend/monitoring/csv_export_spec.js @@ -1,5 +1,5 @@ -import { timeSeriesGraphData } from './graph_data'; import { graphDataToCsv } from '~/monitoring/csv_export'; +import { timeSeriesGraphData } from './graph_data'; describe('monitoring export_csv', () => { describe('graphDataToCsv', () => { diff --git a/spec/frontend/monitoring/mock_data.js b/spec/frontend/monitoring/mock_data.js index ca06c96c7d6..29a7c86491d 100644 --- a/spec/frontend/monitoring/mock_data.js +++ b/spec/frontend/monitoring/mock_data.js @@ -1,6 +1,6 @@ // The path below needs to be relative because we import the mock-data to karma -import { TEST_HOST } from '../__helpers__/test_constants'; import invalidUrl from '~/lib/utils/invalid_url'; +import { TEST_HOST } from '../__helpers__/test_constants'; // This import path needs to be relative for now because this mock data is used in // Karma specs too, where the helpers/test_constants alias can not be resolved diff --git a/spec/frontend/monitoring/requests/index_spec.js b/spec/frontend/monitoring/requests/index_spec.js index 078de5f15d1..b590fe749e0 100644 --- a/spec/frontend/monitoring/requests/index_spec.js +++ b/spec/frontend/monitoring/requests/index_spec.js @@ -3,8 +3,8 @@ import { backoffMockImplementation } from 'helpers/backoff_helper'; import axios from '~/lib/utils/axios_utils'; import statusCodes from '~/lib/utils/http_status'; import * as commonUtils from '~/lib/utils/common_utils'; -import { metricsDashboardResponse } from '../fixture_data'; import { getDashboard, getPrometheusQueryData } from '~/monitoring/requests'; +import { metricsDashboardResponse } from '../fixture_data'; describe('monitoring metrics_requests', () => { let mock; diff --git a/spec/frontend/monitoring/store/utils_spec.js b/spec/frontend/monitoring/store/utils_spec.js index 58bb87cb332..2221909583c 100644 --- a/spec/frontend/monitoring/store/utils_spec.js +++ b/spec/frontend/monitoring/store/utils_spec.js @@ -11,8 +11,8 @@ import { normalizeCustomDashboardPath, } from '~/monitoring/stores/utils'; import * as urlUtils from '~/lib/utils/url_utility'; -import { annotationsData } from '../mock_data'; import { NOT_IN_DB_PREFIX } from '~/monitoring/constants'; +import { annotationsData } from '../mock_data'; const projectPath = 'gitlab-org/gitlab-test'; diff --git a/spec/frontend/monitoring/store/variable_mapping_spec.js b/spec/frontend/monitoring/store/variable_mapping_spec.js index de124b0313c..85e87f361b5 100644 --- a/spec/frontend/monitoring/store/variable_mapping_spec.js +++ b/spec/frontend/monitoring/store/variable_mapping_spec.js @@ -3,13 +3,13 @@ import { mergeURLVariables, optionsFromSeriesData, } from '~/monitoring/stores/variable_mapping'; +import * as urlUtils from '~/lib/utils/url_utility'; import { templatingVariablesExamples, storeTextVariables, storeCustomVariables, storeMetricLabelValuesVariables, } from '../mock_data'; -import * as urlUtils from '~/lib/utils/url_utility'; describe('Monitoring variable mapping', () => { describe('parseTemplatingVariables', () => { diff --git a/spec/frontend/notes/components/discussion_actions_spec.js b/spec/frontend/notes/components/discussion_actions_spec.js index 48e569720e9..03e5842bb0f 100644 --- a/spec/frontend/notes/components/discussion_actions_spec.js +++ b/spec/frontend/notes/components/discussion_actions_spec.js @@ -1,10 +1,10 @@ import { shallowMount, mount } from '@vue/test-utils'; -import { discussionMock } from '../mock_data'; import DiscussionActions from '~/notes/components/discussion_actions.vue'; import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue'; import ResolveDiscussionButton from '~/notes/components/discussion_resolve_button.vue'; import ResolveWithIssueButton from '~/notes/components/discussion_resolve_with_issue_button.vue'; import createStore from '~/notes/stores'; +import { discussionMock } from '../mock_data'; // NOTE: clone mock_data so that it is not accidentally mutated const createDiscussionMock = (props = {}) => diff --git a/spec/frontend/notes/components/discussion_counter_spec.js b/spec/frontend/notes/components/discussion_counter_spec.js index ebf7d52f38b..ca1972c9f61 100644 --- a/spec/frontend/notes/components/discussion_counter_spec.js +++ b/spec/frontend/notes/components/discussion_counter_spec.js @@ -3,8 +3,8 @@ import { shallowMount, createLocalVue } from '@vue/test-utils'; import { GlButton } from '@gitlab/ui'; import notesModule from '~/notes/stores/modules'; import DiscussionCounter from '~/notes/components/discussion_counter.vue'; -import { noteableDataMock, discussionMock, notesDataMock, userDataMock } from '../mock_data'; import * as types from '~/notes/stores/mutation_types'; +import { noteableDataMock, discussionMock, notesDataMock, userDataMock } from '../mock_data'; describe('DiscussionCounter component', () => { let store; diff --git a/spec/frontend/notes/components/note_actions_spec.js b/spec/frontend/notes/components/note_actions_spec.js index 3cfc1445cb8..dfd7a2aae28 100644 --- a/spec/frontend/notes/components/note_actions_spec.js +++ b/spec/frontend/notes/components/note_actions_spec.js @@ -1,11 +1,11 @@ import Vue from 'vue'; import { mount, createLocalVue, createWrapper } from '@vue/test-utils'; -import { TEST_HOST } from 'spec/test_constants'; import AxiosMockAdapter from 'axios-mock-adapter'; +import { TEST_HOST } from 'spec/test_constants'; import createStore from '~/notes/stores'; import noteActions from '~/notes/components/note_actions.vue'; -import { userDataMock } from '../mock_data'; import axios from '~/lib/utils/axios_utils'; +import { userDataMock } from '../mock_data'; describe('noteActions', () => { let wrapper; diff --git a/spec/frontend/notes/components/notes_app_spec.js b/spec/frontend/notes/components/notes_app_spec.js index e495a4738e0..45fbba2524a 100644 --- a/spec/frontend/notes/components/notes_app_spec.js +++ b/spec/frontend/notes/components/notes_app_spec.js @@ -10,9 +10,9 @@ import createStore from '~/notes/stores'; import * as constants from '~/notes/constants'; import '~/behaviors/markdown/render_gfm'; // TODO: use generated fixture (https://gitlab.com/gitlab-org/gitlab-foss/issues/62491) -import * as mockData from '../mock_data'; import * as urlUtility from '~/lib/utils/url_utility'; import OrderedLayout from '~/vue_shared/components/ordered_layout.vue'; +import * as mockData from '../mock_data'; jest.mock('~/user_popovers', () => jest.fn()); diff --git a/spec/frontend/notes/stores/actions_spec.js b/spec/frontend/notes/stores/actions_spec.js index f0e6a0a68dd..5cd8464bf77 100644 --- a/spec/frontend/notes/stores/actions_spec.js +++ b/spec/frontend/notes/stores/actions_spec.js @@ -1,5 +1,5 @@ -import { TEST_HOST } from 'spec/test_constants'; import AxiosMockAdapter from 'axios-mock-adapter'; +import { TEST_HOST } from 'spec/test_constants'; import testAction from 'helpers/vuex_action_helper'; import Api from '~/api'; import { deprecatedCreateFlash as Flash } from '~/flash'; @@ -9,7 +9,11 @@ import * as mutationTypes from '~/notes/stores/mutation_types'; import * as notesConstants from '~/notes/constants'; import createStore from '~/notes/stores'; import mrWidgetEventHub from '~/vue_merge_request_widget/event_hub'; -import { resetStore } from '../helpers'; +import axios from '~/lib/utils/axios_utils'; +import * as utils from '~/notes/stores/utils'; +import updateIssueConfidentialMutation from '~/sidebar/components/confidential/mutations/update_issue_confidential.mutation.graphql'; +import updateMergeRequestLockMutation from '~/sidebar/components/lock/mutations/update_merge_request_lock.mutation.graphql'; +import updateIssueLockMutation from '~/sidebar/components/lock/mutations/update_issue_lock.mutation.graphql'; import { discussionMock, notesDataMock, @@ -18,11 +22,7 @@ import { individualNote, batchSuggestionsInfoMock, } from '../mock_data'; -import axios from '~/lib/utils/axios_utils'; -import * as utils from '~/notes/stores/utils'; -import updateIssueConfidentialMutation from '~/sidebar/components/confidential/mutations/update_issue_confidential.mutation.graphql'; -import updateMergeRequestLockMutation from '~/sidebar/components/lock/mutations/update_merge_request_lock.mutation.graphql'; -import updateIssueLockMutation from '~/sidebar/components/lock/mutations/update_issue_lock.mutation.graphql'; +import { resetStore } from '../helpers'; const TEST_ERROR_MESSAGE = 'Test error message'; jest.mock('~/flash'); diff --git a/spec/frontend/notifications/components/notifications_dropdown_spec.js b/spec/frontend/notifications/components/notifications_dropdown_spec.js index 38040aab0ca..e74729b9d35 100644 --- a/spec/frontend/notifications/components/notifications_dropdown_spec.js +++ b/spec/frontend/notifications/components/notifications_dropdown_spec.js @@ -1,9 +1,9 @@ import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import { shallowMount } from '@vue/test-utils'; +import { GlButtonGroup, GlDropdown, GlDropdownItem } from '@gitlab/ui'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import waitForPromises from 'helpers/wait_for_promises'; -import { GlButtonGroup, GlDropdown, GlDropdownItem } from '@gitlab/ui'; import httpStatus from '~/lib/utils/http_status'; import NotificationsDropdown from '~/notifications/components/notifications_dropdown.vue'; import NotificationsDropdownItem from '~/notifications/components/notifications_dropdown_item.vue'; diff --git a/spec/frontend/packages/details/store/getters_spec.js b/spec/frontend/packages/details/store/getters_spec.js index b8c2138e7f5..e5b130cd958 100644 --- a/spec/frontend/packages/details/store/getters_spec.js +++ b/spec/frontend/packages/details/store/getters_spec.js @@ -17,6 +17,7 @@ import { composerPackageInclude, groupExists, } from '~/packages/details/store/getters'; +import { NpmManager } from '~/packages/details/constants'; import { conanPackage, npmPackage, @@ -32,7 +33,6 @@ import { registryUrl, pypiSetupCommandStr, } from '../mock_data'; -import { NpmManager } from '~/packages/details/constants'; describe('Getters PackageDetails Store', () => { let state; diff --git a/spec/frontend/pages/projects/graphs/code_coverage_spec.js b/spec/frontend/pages/projects/graphs/code_coverage_spec.js index 4a60c7fd509..c9420285bad 100644 --- a/spec/frontend/pages/projects/graphs/code_coverage_spec.js +++ b/spec/frontend/pages/projects/graphs/code_coverage_spec.js @@ -6,8 +6,8 @@ import { GlAreaChart } from '@gitlab/ui/dist/charts'; import waitForPromises from 'helpers/wait_for_promises'; import axios from '~/lib/utils/axios_utils'; import CodeCoverage from '~/pages/projects/graphs/components/code_coverage.vue'; -import { codeCoverageMockData, sortedDataByDates } from './mock_data'; import httpStatusCodes from '~/lib/utils/http_status'; +import { codeCoverageMockData, sortedDataByDates } from './mock_data'; describe('Code Coverage', () => { let wrapper; diff --git a/spec/frontend/pipeline_editor/components/text_editor_spec.js b/spec/frontend/pipeline_editor/components/text_editor_spec.js index b7d5d5acbeb..5cd226a1345 100644 --- a/spec/frontend/pipeline_editor/components/text_editor_spec.js +++ b/spec/frontend/pipeline_editor/components/text_editor_spec.js @@ -1,4 +1,7 @@ import { shallowMount } from '@vue/test-utils'; + +import { EDITOR_READY_EVENT } from '~/editor/constants'; +import TextEditor from '~/pipeline_editor/components/text_editor.vue'; import { mockCiConfigPath, mockCiYml, @@ -7,9 +10,6 @@ import { mockProjectNamespace, } from '../mock_data'; -import { EDITOR_READY_EVENT } from '~/editor/constants'; -import TextEditor from '~/pipeline_editor/components/text_editor.vue'; - describe('~/pipeline_editor/components/text_editor.vue', () => { let wrapper; diff --git a/spec/frontend/pipeline_editor/graphql/resolvers_spec.js b/spec/frontend/pipeline_editor/graphql/resolvers_spec.js index 3e008527415..bee9f53814e 100644 --- a/spec/frontend/pipeline_editor/graphql/resolvers_spec.js +++ b/spec/frontend/pipeline_editor/graphql/resolvers_spec.js @@ -1,5 +1,8 @@ import MockAdapter from 'axios-mock-adapter'; import Api from '~/api'; +import httpStatus from '~/lib/utils/http_status'; +import axios from '~/lib/utils/axios_utils'; +import { resolvers } from '~/pipeline_editor/graphql/resolvers'; import { mockCiConfigPath, mockCiYml, @@ -7,9 +10,6 @@ import { mockLintResponse, mockProjectFullPath, } from '../mock_data'; -import httpStatus from '~/lib/utils/http_status'; -import axios from '~/lib/utils/axios_utils'; -import { resolvers } from '~/pipeline_editor/graphql/resolvers'; jest.mock('~/api', () => { return { diff --git a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js b/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js index d6b90900600..e9423cf3fba 100644 --- a/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js +++ b/spec/frontend/pipeline_editor/pipeline_editor_app_spec.js @@ -1,12 +1,19 @@ import { nextTick } from 'vue'; import { mount, shallowMount, createLocalVue } from '@vue/test-utils'; import { GlAlert, GlButton, GlFormInput, GlFormTextarea, GlLoadingIcon, GlTabs } from '@gitlab/ui'; -import waitForPromises from 'helpers/wait_for_promises'; import VueApollo from 'vue-apollo'; +import waitForPromises from 'helpers/wait_for_promises'; import createMockApollo from 'helpers/mock_apollo_helper'; import httpStatusCodes from '~/lib/utils/http_status'; import { objectToQuery, redirectTo, refreshCurrentPage } from '~/lib/utils/url_utility'; + +import CommitForm from '~/pipeline_editor/components/commit/commit_form.vue'; +import getCiConfigData from '~/pipeline_editor/graphql/queries/ci_config.graphql'; +import EditorTab from '~/pipeline_editor/components/ui/editor_tab.vue'; +import PipelineGraph from '~/pipelines/components/pipeline_graph/pipeline_graph.vue'; +import PipelineEditorApp from '~/pipeline_editor/pipeline_editor_app.vue'; +import TextEditor from '~/pipeline_editor/components/text_editor.vue'; import { mockCiConfigPath, mockCiConfigQueryResponse, @@ -21,13 +28,6 @@ import { mockNewMergeRequestPath, } from './mock_data'; -import CommitForm from '~/pipeline_editor/components/commit/commit_form.vue'; -import getCiConfigData from '~/pipeline_editor/graphql/queries/ci_config.graphql'; -import EditorTab from '~/pipeline_editor/components/ui/editor_tab.vue'; -import PipelineGraph from '~/pipelines/components/pipeline_graph/pipeline_graph.vue'; -import PipelineEditorApp from '~/pipeline_editor/pipeline_editor_app.vue'; -import TextEditor from '~/pipeline_editor/components/text_editor.vue'; - const localVue = createLocalVue(); localVue.use(VueApollo); diff --git a/spec/frontend/pipeline_new/components/pipeline_new_form_spec.js b/spec/frontend/pipeline_new/components/pipeline_new_form_spec.js index 904226708fe..cf3745f4156 100644 --- a/spec/frontend/pipeline_new/components/pipeline_new_form_spec.js +++ b/spec/frontend/pipeline_new/components/pipeline_new_form_spec.js @@ -5,6 +5,7 @@ import waitForPromises from 'helpers/wait_for_promises'; import httpStatusCodes from '~/lib/utils/http_status'; import axios from '~/lib/utils/axios_utils'; import PipelineNewForm from '~/pipeline_new/components/pipeline_new_form.vue'; +import { redirectTo } from '~/lib/utils/url_utility'; import { mockBranches, mockTags, @@ -13,7 +14,6 @@ import { mockProjectId, mockError, } from '../mock_data'; -import { redirectTo } from '~/lib/utils/url_utility'; jest.mock('~/lib/utils/url_utility', () => ({ redirectTo: jest.fn(), diff --git a/spec/frontend/pipelines/graph/graph_component_legacy_spec.js b/spec/frontend/pipelines/graph/graph_component_legacy_spec.js index 840b1f8baf5..1bde9cae7d2 100644 --- a/spec/frontend/pipelines/graph/graph_component_legacy_spec.js +++ b/spec/frontend/pipelines/graph/graph_component_legacy_spec.js @@ -6,9 +6,9 @@ import PipelineStore from '~/pipelines/stores/pipeline_store'; import GraphComponentLegacy from '~/pipelines/components/graph/graph_component_legacy.vue'; import StageColumnComponentLegacy from '~/pipelines/components/graph/stage_column_component_legacy.vue'; import LinkedPipelinesColumnLegacy from '~/pipelines/components/graph/linked_pipelines_column_legacy.vue'; +import PipelinesMediator from '~/pipelines/pipeline_details_mediator'; import graphJSON from './mock_data_legacy'; import linkedPipelineJSON from './linked_pipelines_mock_data'; -import PipelinesMediator from '~/pipelines/pipeline_details_mediator'; describe('graph component', () => { let store; diff --git a/spec/frontend/pipelines/graph/linked_pipeline_spec.js b/spec/frontend/pipelines/graph/linked_pipeline_spec.js index fb005d628a9..dad83c4d86e 100644 --- a/spec/frontend/pipelines/graph/linked_pipeline_spec.js +++ b/spec/frontend/pipelines/graph/linked_pipeline_spec.js @@ -2,8 +2,8 @@ import { mount } from '@vue/test-utils'; import { GlButton, GlLoadingIcon } from '@gitlab/ui'; import LinkedPipelineComponent from '~/pipelines/components/graph/linked_pipeline.vue'; import CiStatus from '~/vue_shared/components/ci_icon.vue'; -import mockData from './linked_pipelines_mock_data'; import { UPSTREAM, DOWNSTREAM } from '~/pipelines/components/graph/constants'; +import mockData from './linked_pipelines_mock_data'; const mockPipeline = mockData.triggered[0]; const validTriggeredPipelineId = mockPipeline.project.id; diff --git a/spec/frontend/pipelines/header_component_spec.js b/spec/frontend/pipelines/header_component_spec.js index 03e385e3cc8..5b4cd7b71fe 100644 --- a/spec/frontend/pipelines/header_component_spec.js +++ b/spec/frontend/pipelines/header_component_spec.js @@ -1,15 +1,15 @@ import { shallowMount } from '@vue/test-utils'; import { GlModal, GlLoadingIcon } from '@gitlab/ui'; +import HeaderComponent from '~/pipelines/components/header_component.vue'; +import deletePipelineMutation from '~/pipelines/graphql/mutations/delete_pipeline.mutation.graphql'; +import retryPipelineMutation from '~/pipelines/graphql/mutations/retry_pipeline.mutation.graphql'; +import cancelPipelineMutation from '~/pipelines/graphql/mutations/cancel_pipeline.mutation.graphql'; import { mockCancelledPipelineHeader, mockFailedPipelineHeader, mockRunningPipelineHeader, mockSuccessfulPipelineHeader, } from './mock_data'; -import HeaderComponent from '~/pipelines/components/header_component.vue'; -import deletePipelineMutation from '~/pipelines/graphql/mutations/delete_pipeline.mutation.graphql'; -import retryPipelineMutation from '~/pipelines/graphql/mutations/retry_pipeline.mutation.graphql'; -import cancelPipelineMutation from '~/pipelines/graphql/mutations/cancel_pipeline.mutation.graphql'; describe('Pipeline details header', () => { let wrapper; diff --git a/spec/frontend/pipelines/pipeline_graph/pipeline_graph_spec.js b/spec/frontend/pipelines/pipeline_graph/pipeline_graph_spec.js index b6b0a964383..5462045c5c4 100644 --- a/spec/frontend/pipelines/pipeline_graph/pipeline_graph_spec.js +++ b/spec/frontend/pipelines/pipeline_graph/pipeline_graph_spec.js @@ -1,11 +1,11 @@ import { shallowMount } from '@vue/test-utils'; import { GlAlert } from '@gitlab/ui'; -import { pipelineData, singleStageData } from './mock_data'; import { CI_CONFIG_STATUS_INVALID, CI_CONFIG_STATUS_VALID } from '~/pipeline_editor/constants'; import { DRAW_FAILURE, EMPTY_PIPELINE_DATA, INVALID_CI_CONFIG } from '~/pipelines/constants'; import PipelineGraph from '~/pipelines/components/pipeline_graph/pipeline_graph.vue'; import StagePill from '~/pipelines/components/pipeline_graph/stage_pill.vue'; import JobPill from '~/pipelines/components/pipeline_graph/job_pill.vue'; +import { pipelineData, singleStageData } from './mock_data'; describe('pipeline graph component', () => { const defaultProps = { pipelineData }; diff --git a/spec/frontend/pipelines/pipeline_url_spec.js b/spec/frontend/pipelines/pipeline_url_spec.js index 859db114293..5266127ca60 100644 --- a/spec/frontend/pipelines/pipeline_url_spec.js +++ b/spec/frontend/pipelines/pipeline_url_spec.js @@ -1,6 +1,6 @@ import $ from 'jquery'; -import { trimText } from 'helpers/text_helper'; import { shallowMount } from '@vue/test-utils'; +import { trimText } from 'helpers/text_helper'; import PipelineUrlComponent from '~/pipelines/components/pipelines_list/pipeline_url.vue'; $.fn.popover = () => {}; diff --git a/spec/frontend/pipelines/pipelines_actions_spec.js b/spec/frontend/pipelines/pipelines_actions_spec.js index 69c1b7ce43d..4e21ade2175 100644 --- a/spec/frontend/pipelines/pipelines_actions_spec.js +++ b/spec/frontend/pipelines/pipelines_actions_spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; -import { TEST_HOST } from 'spec/test_constants'; import { GlButton } from '@gitlab/ui'; +import { TEST_HOST } from 'spec/test_constants'; import waitForPromises from 'helpers/wait_for_promises'; import axios from '~/lib/utils/axios_utils'; import PipelinesActions from '~/pipelines/components/pipelines_list/pipelines_actions.vue'; diff --git a/spec/frontend/pipelines/pipelines_spec.js b/spec/frontend/pipelines/pipelines_spec.js index 5d82669b0b8..e6a8b9e37e4 100644 --- a/spec/frontend/pipelines/pipelines_spec.js +++ b/spec/frontend/pipelines/pipelines_spec.js @@ -1,8 +1,8 @@ import { nextTick } from 'vue'; import { mount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; -import waitForPromises from 'helpers/wait_for_promises'; import { GlFilteredSearch, GlButton, GlLoadingIcon } from '@gitlab/ui'; +import waitForPromises from 'helpers/wait_for_promises'; import Api from '~/api'; import axios from '~/lib/utils/axios_utils'; import NavigationTabs from '~/vue_shared/components/navigation_tabs.vue'; @@ -15,9 +15,9 @@ import PipelinesTableComponent from '~/pipelines/components/pipelines_list/pipel import PipelinesComponent from '~/pipelines/components/pipelines_list/pipelines.vue'; import Store from '~/pipelines/stores/pipelines_store'; -import { pipelineWithStages, stageReply, users, mockSearch, branches } from './mock_data'; import { RAW_TEXT_WARNING } from '~/pipelines/constants'; import { deprecatedCreateFlash as createFlash } from '~/flash'; +import { pipelineWithStages, stageReply, users, mockSearch, branches } from './mock_data'; jest.mock('~/flash'); diff --git a/spec/frontend/pipelines/test_reports/test_suite_table_spec.js b/spec/frontend/pipelines/test_reports/test_suite_table_spec.js index b8fd056610b..57545aec50f 100644 --- a/spec/frontend/pipelines/test_reports/test_suite_table_spec.js +++ b/spec/frontend/pipelines/test_reports/test_suite_table_spec.js @@ -1,7 +1,7 @@ import Vuex from 'vuex'; import { shallowMount, createLocalVue } from '@vue/test-utils'; -import { getJSONFixture } from 'helpers/fixtures'; import { GlButton, GlFriendlyWrap, GlPagination } from '@gitlab/ui'; +import { getJSONFixture } from 'helpers/fixtures'; import SuiteTable from '~/pipelines/components/test_reports/test_suite_table.vue'; import * as getters from '~/pipelines/stores/test_reports/getters'; import { TestStatus } from '~/pipelines/constants'; diff --git a/spec/frontend/pipelines/tokens/pipeline_trigger_author_token_spec.js b/spec/frontend/pipelines/tokens/pipeline_trigger_author_token_spec.js index 371ba5a4f9b..7ddbbb3b005 100644 --- a/spec/frontend/pipelines/tokens/pipeline_trigger_author_token_spec.js +++ b/spec/frontend/pipelines/tokens/pipeline_trigger_author_token_spec.js @@ -1,6 +1,6 @@ import { GlFilteredSearchToken, GlFilteredSearchSuggestion, GlLoadingIcon } from '@gitlab/ui'; -import { stubComponent } from 'helpers/stub_component'; import { shallowMount } from '@vue/test-utils'; +import { stubComponent } from 'helpers/stub_component'; import Api from '~/api'; import PipelineTriggerAuthorToken from '~/pipelines/components/pipelines_list/tokens/pipeline_trigger_author_token.vue'; import { users } from '../mock_data'; diff --git a/spec/frontend/profile/account/components/delete_account_modal_spec.js b/spec/frontend/profile/account/components/delete_account_modal_spec.js index 63e27473979..82d2ab2d18a 100644 --- a/spec/frontend/profile/account/components/delete_account_modal_spec.js +++ b/spec/frontend/profile/account/components/delete_account_modal_spec.js @@ -1,8 +1,8 @@ import Vue from 'vue'; -import { TEST_HOST } from 'helpers/test_constants'; import { merge } from 'lodash'; import { mount } from '@vue/test-utils'; +import { TEST_HOST } from 'helpers/test_constants'; import deleteAccountModal from '~/profile/account/components/delete_account_modal.vue'; const GlModalStub = { diff --git a/spec/frontend/projects/commit/components/branches_dropdown_spec.js b/spec/frontend/projects/commit/components/branches_dropdown_spec.js index 9fa7d658405..6f816006ae3 100644 --- a/spec/frontend/projects/commit/components/branches_dropdown_spec.js +++ b/spec/frontend/projects/commit/components/branches_dropdown_spec.js @@ -1,8 +1,8 @@ import Vue from 'vue'; import Vuex from 'vuex'; import { shallowMount } from '@vue/test-utils'; -import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { GlDropdownItem, GlSearchBoxByType } from '@gitlab/ui'; +import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import BranchesDropdown from '~/projects/commit/components/branches_dropdown.vue'; Vue.use(Vuex); diff --git a/spec/frontend/projects/commit/components/form_modal_spec.js b/spec/frontend/projects/commit/components/form_modal_spec.js index eb1c4570cd2..e197ca8eace 100644 --- a/spec/frontend/projects/commit/components/form_modal_spec.js +++ b/spec/frontend/projects/commit/components/form_modal_spec.js @@ -1,8 +1,8 @@ import MockAdapter from 'axios-mock-adapter'; import { shallowMount, mount, createWrapper } from '@vue/test-utils'; -import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { GlModal, GlForm, GlFormCheckbox, GlSprintf } from '@gitlab/ui'; import { within } from '@testing-library/dom'; +import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import axios from '~/lib/utils/axios_utils'; import eventHub from '~/projects/commit/event_hub'; import CommitFormModal from '~/projects/commit/components/form_modal.vue'; diff --git a/spec/frontend/projects/commit/store/actions_spec.js b/spec/frontend/projects/commit/store/actions_spec.js index ec528d4ee88..e10e8fab440 100644 --- a/spec/frontend/projects/commit/store/actions_spec.js +++ b/spec/frontend/projects/commit/store/actions_spec.js @@ -5,8 +5,8 @@ import createFlash from '~/flash'; import getInitialState from '~/projects/commit/store/state'; import * as actions from '~/projects/commit/store/actions'; import * as types from '~/projects/commit/store/mutation_types'; -import mockData from '../mock_data'; import { PROJECT_BRANCHES_ERROR } from '~/projects/commit/constants'; +import mockData from '../mock_data'; jest.mock('~/flash.js'); diff --git a/spec/frontend/projects/commit_box/info/load_branches_spec.js b/spec/frontend/projects/commit_box/info/load_branches_spec.js index ebd4ee45dab..8100200cbdd 100644 --- a/spec/frontend/projects/commit_box/info/load_branches_spec.js +++ b/spec/frontend/projects/commit_box/info/load_branches_spec.js @@ -1,6 +1,6 @@ import axios from 'axios'; -import waitForPromises from 'helpers/wait_for_promises'; import MockAdapter from 'axios-mock-adapter'; +import waitForPromises from 'helpers/wait_for_promises'; import { loadBranches } from '~/projects/commit_box/info/load_branches'; const mockCommitPath = '/commit/abcd/branches'; diff --git a/spec/frontend/registry/explorer/components/details_page/empty_state_spec.js b/spec/frontend/registry/explorer/components/details_page/empty_state_spec.js new file mode 100644 index 00000000000..7739f111906 --- /dev/null +++ b/spec/frontend/registry/explorer/components/details_page/empty_state_spec.js @@ -0,0 +1,54 @@ +import { shallowMount } from '@vue/test-utils'; +import { GlEmptyState } from '@gitlab/ui'; +import component from '~/registry/explorer/components/details_page/empty_state.vue'; +import { + NO_TAGS_TITLE, + NO_TAGS_MESSAGE, + MISSING_OR_DELETED_IMAGE_TITLE, + MISSING_OR_DELETED_IMAGE_MESSAGE, +} from '~/registry/explorer/constants'; + +describe('EmptyTagsState component', () => { + let wrapper; + + const findEmptyState = () => wrapper.find(GlEmptyState); + + const mountComponent = (propsData) => { + wrapper = shallowMount(component, { + stubs: { + GlEmptyState, + }, + propsData, + }); + }; + + afterEach(() => { + wrapper.destroy(); + wrapper = null; + }); + + it('contains gl-empty-state', () => { + mountComponent(); + expect(findEmptyState().exists()).toBe(true); + }); + + it.each` + isEmptyImage | title | description + ${false} | ${NO_TAGS_TITLE} | ${NO_TAGS_MESSAGE} + ${true} | ${MISSING_OR_DELETED_IMAGE_TITLE} | ${MISSING_OR_DELETED_IMAGE_MESSAGE} + `( + 'when isEmptyImage is $isEmptyImage has the correct props', + ({ isEmptyImage, title, description }) => { + mountComponent({ + noContainersImage: 'foo', + isEmptyImage, + }); + + expect(findEmptyState().props()).toMatchObject({ + title, + description, + svgPath: 'foo', + }); + }, + ); +}); diff --git a/spec/frontend/registry/explorer/components/details_page/empty_tags_state_spec.js b/spec/frontend/registry/explorer/components/details_page/empty_tags_state_spec.js deleted file mode 100644 index 09afd9d2d84..00000000000 --- a/spec/frontend/registry/explorer/components/details_page/empty_tags_state_spec.js +++ /dev/null @@ -1,43 +0,0 @@ -import { shallowMount } from '@vue/test-utils'; -import { GlEmptyState } from '@gitlab/ui'; -import component from '~/registry/explorer/components/details_page/empty_tags_state.vue'; -import { - EMPTY_IMAGE_REPOSITORY_TITLE, - EMPTY_IMAGE_REPOSITORY_MESSAGE, -} from '~/registry/explorer/constants'; - -describe('EmptyTagsState component', () => { - let wrapper; - - const findEmptyState = () => wrapper.find(GlEmptyState); - - const mountComponent = () => { - wrapper = shallowMount(component, { - stubs: { - GlEmptyState, - }, - propsData: { - noContainersImage: 'foo', - }, - }); - }; - - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - - it('contains gl-empty-state', () => { - mountComponent(); - expect(findEmptyState().exists()).toBe(true); - }); - - it('has the correct props', () => { - mountComponent(); - expect(findEmptyState().props()).toMatchObject({ - title: EMPTY_IMAGE_REPOSITORY_TITLE, - description: EMPTY_IMAGE_REPOSITORY_MESSAGE, - svgPath: 'foo', - }); - }); -}); diff --git a/spec/frontend/registry/explorer/components/list_page/group_empty_state_spec.js b/spec/frontend/registry/explorer/components/list_page/group_empty_state_spec.js index 1ba2036dc34..ffdc6b787cb 100644 --- a/spec/frontend/registry/explorer/components/list_page/group_empty_state_spec.js +++ b/spec/frontend/registry/explorer/components/list_page/group_empty_state_spec.js @@ -1,8 +1,8 @@ import Vuex from 'vuex'; import { shallowMount, createLocalVue } from '@vue/test-utils'; import { GlSprintf } from '@gitlab/ui'; -import { GlEmptyState } from '../../stubs'; import groupEmptyState from '~/registry/explorer/components/list_page/group_empty_state.vue'; +import { GlEmptyState } from '../../stubs'; const localVue = createLocalVue(); localVue.use(Vuex); diff --git a/spec/frontend/registry/explorer/components/list_page/project_empty_state_spec.js b/spec/frontend/registry/explorer/components/list_page/project_empty_state_spec.js index 3a27cf1923c..cbd1f1a99db 100644 --- a/spec/frontend/registry/explorer/components/list_page/project_empty_state_spec.js +++ b/spec/frontend/registry/explorer/components/list_page/project_empty_state_spec.js @@ -1,8 +1,8 @@ import Vuex from 'vuex'; import { shallowMount, createLocalVue } from '@vue/test-utils'; import { GlSprintf } from '@gitlab/ui'; -import { GlEmptyState } from '../../stubs'; import projectEmptyState from '~/registry/explorer/components/list_page/project_empty_state.vue'; +import { GlEmptyState } from '../../stubs'; import { dockerCommands } from '../../mock_data'; const localVue = createLocalVue(); diff --git a/spec/frontend/registry/explorer/mock_data.js b/spec/frontend/registry/explorer/mock_data.js index b0fc009872c..f4453912db4 100644 --- a/spec/frontend/registry/explorer/mock_data.js +++ b/spec/frontend/registry/explorer/mock_data.js @@ -235,3 +235,9 @@ export const graphQLProjectImageRepositoriesDetailsMock = { }, }, }; + +export const graphQLEmptyImageDetailsMock = { + data: { + containerRepository: null, + }, +}; diff --git a/spec/frontend/registry/explorer/pages/details_spec.js b/spec/frontend/registry/explorer/pages/details_spec.js index 9e6e74e22f0..7106cdae27f 100644 --- a/spec/frontend/registry/explorer/pages/details_spec.js +++ b/spec/frontend/registry/explorer/pages/details_spec.js @@ -11,7 +11,7 @@ import PartialCleanupAlert from '~/registry/explorer/components/details_page/par import DetailsHeader from '~/registry/explorer/components/details_page/details_header.vue'; import TagsLoader from '~/registry/explorer/components/details_page/tags_loader.vue'; import TagsList from '~/registry/explorer/components/details_page/tags_list.vue'; -import EmptyTagsState from '~/registry/explorer/components/details_page/empty_tags_state.vue'; +import EmptyTagsState from '~/registry/explorer/components/details_page/empty_state.vue'; import getContainerRepositoryDetailsQuery from '~/registry/explorer/graphql/queries/get_container_repository_details.query.graphql'; import deleteContainerRepositoryTagsMutation from '~/registry/explorer/graphql/mutations/delete_container_repository_tags.mutation.graphql'; @@ -23,6 +23,7 @@ import { graphQLImageDetailsEmptyTagsMock, graphQLDeleteImageRepositoryTagsMock, containerRepositoryMock, + graphQLEmptyImageDetailsMock, tagsMock, tagsPageInfo, } from '../mock_data'; @@ -40,7 +41,7 @@ describe('Details Page', () => { const findTagsList = () => wrapper.find(TagsList); const findDeleteAlert = () => wrapper.find(DeleteAlert); const findDetailsHeader = () => wrapper.find(DetailsHeader); - const findEmptyTagsState = () => wrapper.find(EmptyTagsState); + const findEmptyState = () => wrapper.find(EmptyTagsState); const findPartialCleanupAlert = () => wrapper.find(PartialCleanupAlert); const routeId = 1; @@ -134,6 +135,27 @@ describe('Details Page', () => { }); }); + describe('when the image does not exist', () => { + it('does not show the default ui', async () => { + mountComponent({ resolver: jest.fn().mockResolvedValue(graphQLEmptyImageDetailsMock) }); + + await waitForApolloRequestRender(); + + expect(findTagsLoader().exists()).toBe(false); + expect(findDetailsHeader().exists()).toBe(false); + expect(findTagsList().exists()).toBe(false); + expect(findPagination().exists()).toBe(false); + }); + + it('shows an empty state message', async () => { + mountComponent({ resolver: jest.fn().mockResolvedValue(graphQLEmptyImageDetailsMock) }); + + await waitForApolloRequestRender(); + + expect(findEmptyState().exists()).toBe(true); + }); + }); + describe('when the list of tags is empty', () => { const resolver = jest.fn().mockResolvedValue(graphQLImageDetailsEmptyTagsMock); @@ -142,7 +164,7 @@ describe('Details Page', () => { await waitForApolloRequestRender(); - expect(findEmptyTagsState().exists()).toBe(true); + expect(findEmptyState().exists()).toBe(true); }); it('does not show the loader', async () => { diff --git a/spec/frontend/releases/components/app_index_spec.js b/spec/frontend/releases/components/app_index_spec.js index 1481dd30fd4..3c5ee212225 100644 --- a/spec/frontend/releases/components/app_index_spec.js +++ b/spec/frontend/releases/components/app_index_spec.js @@ -7,9 +7,9 @@ import ReleasesApp from '~/releases/components/app_index.vue'; import createStore from '~/releases/stores'; import createListModule from '~/releases/stores/modules/list'; import api from '~/api'; -import { pageInfoHeadersWithoutPagination, pageInfoHeadersWithPagination } from '../mock_data'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import ReleasesPagination from '~/releases/components/releases_pagination.vue'; +import { pageInfoHeadersWithoutPagination, pageInfoHeadersWithPagination } from '../mock_data'; jest.mock('~/lib/utils/common_utils', () => ({ ...jest.requireActual('~/lib/utils/common_utils'), diff --git a/spec/frontend/releases/components/release_block_footer_spec.js b/spec/frontend/releases/components/release_block_footer_spec.js index f1c0c24f8ca..b3161f9fc0d 100644 --- a/spec/frontend/releases/components/release_block_footer_spec.js +++ b/spec/frontend/releases/components/release_block_footer_spec.js @@ -1,8 +1,8 @@ import { mount } from '@vue/test-utils'; import { GlLink, GlIcon } from '@gitlab/ui'; +import { cloneDeep } from 'lodash'; import { trimText } from 'helpers/text_helper'; import { getJSONFixture } from 'helpers/fixtures'; -import { cloneDeep } from 'lodash'; import ReleaseBlockFooter from '~/releases/components/release_block_footer.vue'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; diff --git a/spec/frontend/releases/stores/modules/detail/actions_spec.js b/spec/frontend/releases/stores/modules/detail/actions_spec.js index 396e7bd8745..39c00ae69fe 100644 --- a/spec/frontend/releases/stores/modules/detail/actions_spec.js +++ b/spec/frontend/releases/stores/modules/detail/actions_spec.js @@ -1,8 +1,8 @@ import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; +import { cloneDeep } from 'lodash'; import testAction from 'helpers/vuex_action_helper'; import { getJSONFixture } from 'helpers/fixtures'; -import { cloneDeep } from 'lodash'; import * as actions from '~/releases/stores/modules/detail/actions'; import * as types from '~/releases/stores/modules/detail/mutation_types'; import createState from '~/releases/stores/modules/detail/state'; diff --git a/spec/frontend/releases/stores/modules/list/actions_spec.js b/spec/frontend/releases/stores/modules/list/actions_spec.js index 35551b77dc4..278c8b3b3d3 100644 --- a/spec/frontend/releases/stores/modules/list/actions_spec.js +++ b/spec/frontend/releases/stores/modules/list/actions_spec.js @@ -17,9 +17,9 @@ import { parseIntPagination, convertObjectPropsToCamelCase, } from '~/lib/utils/common_utils'; -import { pageInfoHeadersWithoutPagination } from '../../../mock_data'; import allReleasesQuery from '~/releases/queries/all_releases.query.graphql'; import { PAGE_SIZE } from '~/releases/constants'; +import { pageInfoHeadersWithoutPagination } from '../../../mock_data'; const originalRelease = getJSONFixture('api/releases/release.json'); const originalReleases = [originalRelease]; diff --git a/spec/frontend/releases/stores/modules/list/mutations_spec.js b/spec/frontend/releases/stores/modules/list/mutations_spec.js index 78071573072..7eb78b23b7b 100644 --- a/spec/frontend/releases/stores/modules/list/mutations_spec.js +++ b/spec/frontend/releases/stores/modules/list/mutations_spec.js @@ -3,8 +3,8 @@ import createState from '~/releases/stores/modules/list/state'; import mutations from '~/releases/stores/modules/list/mutations'; import * as types from '~/releases/stores/modules/list/mutation_types'; import { parseIntPagination, convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; -import { pageInfoHeadersWithoutPagination } from '../../../mock_data'; import { convertAllReleasesGraphQLResponse } from '~/releases/util'; +import { pageInfoHeadersWithoutPagination } from '../../../mock_data'; const originalRelease = getJSONFixture('api/releases/release.json'); const originalReleases = [originalRelease]; diff --git a/spec/frontend/serverless/components/environment_row_spec.js b/spec/frontend/serverless/components/environment_row_spec.js index a59b4fdbb7b..944283136d0 100644 --- a/spec/frontend/serverless/components/environment_row_spec.js +++ b/spec/frontend/serverless/components/environment_row_spec.js @@ -1,8 +1,8 @@ import { shallowMount } from '@vue/test-utils'; import environmentRowComponent from '~/serverless/components/environment_row.vue'; -import { mockServerlessFunctions, mockServerlessFunctionsDiffEnv } from '../mock_data'; import { translate } from '~/serverless/utils'; +import { mockServerlessFunctions, mockServerlessFunctionsDiffEnv } from '../mock_data'; const createComponent = (env, envName) => shallowMount(environmentRowComponent, { diff --git a/spec/frontend/serverless/store/actions_spec.js b/spec/frontend/serverless/store/actions_spec.js index 32e30a57d4b..41d99fcb26c 100644 --- a/spec/frontend/serverless/store/actions_spec.js +++ b/spec/frontend/serverless/store/actions_spec.js @@ -2,8 +2,8 @@ import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; import statusCodes from '~/lib/utils/http_status'; import { fetchFunctions, fetchMetrics } from '~/serverless/store/actions'; -import { mockServerlessFunctions, mockMetrics } from '../mock_data'; import axios from '~/lib/utils/axios_utils'; +import { mockServerlessFunctions, mockMetrics } from '../mock_data'; import { adjustMetricQuery } from '../utils'; describe('ServerlessActions', () => { diff --git a/spec/frontend/sidebar/assignees_realtime_spec.js b/spec/frontend/sidebar/assignees_realtime_spec.js index 1c62c52dc67..a7e280b5ae1 100644 --- a/spec/frontend/sidebar/assignees_realtime_spec.js +++ b/spec/frontend/sidebar/assignees_realtime_spec.js @@ -2,8 +2,8 @@ import { shallowMount } from '@vue/test-utils'; import ActionCable from '@rails/actioncable'; import AssigneesRealtime from '~/sidebar/components/assignees/assignees_realtime.vue'; import SidebarMediator from '~/sidebar/sidebar_mediator'; -import Mock from './mock_data'; import query from '~/issuable_sidebar/queries/issue_sidebar.query.graphql'; +import Mock from './mock_data'; jest.mock('@rails/actioncable', () => { const mockConsumer = { diff --git a/spec/frontend/sidebar/assignees_spec.js b/spec/frontend/sidebar/assignees_spec.js index 23e82171fe9..fbf5fca2234 100644 --- a/spec/frontend/sidebar/assignees_spec.js +++ b/spec/frontend/sidebar/assignees_spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; -import { trimText } from 'helpers/text_helper'; import { GlIcon } from '@gitlab/ui'; +import { trimText } from 'helpers/text_helper'; import UsersMockHelper from 'helpers/user_mock_data_helper'; import Assignee from '~/sidebar/components/assignees/assignees.vue'; import UsersMock from './mock_data'; diff --git a/spec/frontend/sidebar/components/time_tracking/time_tracker_spec.js b/spec/frontend/sidebar/components/time_tracking/time_tracker_spec.js index 0b6a2e6ceb9..d52a59bb67b 100644 --- a/spec/frontend/sidebar/components/time_tracking/time_tracker_spec.js +++ b/spec/frontend/sidebar/components/time_tracking/time_tracker_spec.js @@ -1,5 +1,5 @@ -import { createMockDirective } from 'helpers/vue_mock_directive'; import { mount } from '@vue/test-utils'; +import { createMockDirective } from 'helpers/vue_mock_directive'; import { stubTransition } from 'helpers/stub_transition'; import TimeTracker from '~/sidebar/components/time_tracking/time_tracker.vue'; diff --git a/spec/frontend/sidebar/reviewers_spec.js b/spec/frontend/sidebar/reviewers_spec.js index 91f28e85f3b..c6d15a9270f 100644 --- a/spec/frontend/sidebar/reviewers_spec.js +++ b/spec/frontend/sidebar/reviewers_spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; -import { trimText } from 'helpers/text_helper'; import { GlIcon } from '@gitlab/ui'; +import { trimText } from 'helpers/text_helper'; import UsersMockHelper from 'helpers/user_mock_data_helper'; import Reviewer from '~/sidebar/components/reviewers/reviewers.vue'; import UsersMock from './mock_data'; diff --git a/spec/frontend/snippets/components/show_spec.js b/spec/frontend/snippets/components/show_spec.js index b5ab7def753..6dbf7cfc4b4 100644 --- a/spec/frontend/snippets/components/show_spec.js +++ b/spec/frontend/snippets/components/show_spec.js @@ -1,6 +1,6 @@ import { GlLoadingIcon } from '@gitlab/ui'; -import { Blob, BinaryBlob } from 'jest/blob/components/mock_data'; import { shallowMount } from '@vue/test-utils'; +import { Blob, BinaryBlob } from 'jest/blob/components/mock_data'; import SnippetApp from '~/snippets/components/show.vue'; import EmbedDropdown from '~/snippets/components/embed_dropdown.vue'; import SnippetHeader from '~/snippets/components/snippet_header.vue'; diff --git a/spec/frontend/static_site_editor/components/edit_meta_modal_spec.js b/spec/frontend/static_site_editor/components/edit_meta_modal_spec.js index c7d0abee05c..d80b28b91f8 100644 --- a/spec/frontend/static_site_editor/components/edit_meta_modal_spec.js +++ b/spec/frontend/static_site_editor/components/edit_meta_modal_spec.js @@ -1,7 +1,7 @@ import { shallowMount } from '@vue/test-utils'; import { GlModal } from '@gitlab/ui'; -import { useLocalStorageSpy } from 'helpers/local_storage_helper'; import MockAdapter from 'axios-mock-adapter'; +import { useLocalStorageSpy } from 'helpers/local_storage_helper'; import axios from '~/lib/utils/axios_utils'; import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue'; import EditMetaModal from '~/static_site_editor/components/edit_meta_modal.vue'; diff --git a/spec/frontend/static_site_editor/pages/success_spec.js b/spec/frontend/static_site_editor/pages/success_spec.js index 3fc69dc4586..7d2d5edda84 100644 --- a/spec/frontend/static_site_editor/pages/success_spec.js +++ b/spec/frontend/static_site_editor/pages/success_spec.js @@ -1,8 +1,8 @@ import { shallowMount } from '@vue/test-utils'; import { GlButton, GlEmptyState, GlLoadingIcon } from '@gitlab/ui'; import Success from '~/static_site_editor/pages/success.vue'; -import { savedContentMeta, returnUrl, sourcePath } from '../mock_data'; import { HOME_ROUTE } from '~/static_site_editor/router/constants'; +import { savedContentMeta, returnUrl, sourcePath } from '../mock_data'; describe('~/static_site_editor/pages/success.vue', () => { const mergeRequestsIllustrationPath = 'illustrations/merge_requests.svg'; diff --git a/spec/frontend/static_site_editor/services/front_matterify_spec.js b/spec/frontend/static_site_editor/services/front_matterify_spec.js index 866897f21ef..ec3752b30c6 100644 --- a/spec/frontend/static_site_editor/services/front_matterify_spec.js +++ b/spec/frontend/static_site_editor/services/front_matterify_spec.js @@ -1,3 +1,4 @@ +import { frontMatterify, stringify } from '~/static_site_editor/services/front_matterify'; import { sourceContentYAML as content, sourceContentHeaderObjYAML as yamlFrontMatterObj, @@ -5,8 +6,6 @@ import { sourceContentBody as body, } from '../mock_data'; -import { frontMatterify, stringify } from '~/static_site_editor/services/front_matterify'; - describe('static_site_editor/services/front_matterify', () => { const frontMatterifiedContent = { source: content, diff --git a/spec/frontend/static_site_editor/services/parse_source_file_spec.js b/spec/frontend/static_site_editor/services/parse_source_file_spec.js index ab9e63f4cd2..fdd11297e09 100644 --- a/spec/frontend/static_site_editor/services/parse_source_file_spec.js +++ b/spec/frontend/static_site_editor/services/parse_source_file_spec.js @@ -1,3 +1,4 @@ +import parseSourceFile from '~/static_site_editor/services/parse_source_file'; import { sourceContentYAML as content, sourceContentHeaderYAML as yamlFrontMatter, @@ -5,8 +6,6 @@ import { sourceContentBody as body, } from '../mock_data'; -import parseSourceFile from '~/static_site_editor/services/parse_source_file'; - describe('static_site_editor/services/parse_source_file', () => { const contentComplex = [content, content, content].join(''); const complexBody = [body, content, content].join(''); diff --git a/spec/frontend/terraform/components/states_table_actions_spec.js b/spec/frontend/terraform/components/states_table_actions_spec.js index 1f9bede2e6e..6100b1f67a2 100644 --- a/spec/frontend/terraform/components/states_table_actions_spec.js +++ b/spec/frontend/terraform/components/states_table_actions_spec.js @@ -1,8 +1,8 @@ import { GlDropdown, GlModal, GlSprintf } from '@gitlab/ui'; import { createLocalVue, shallowMount } from '@vue/test-utils'; +import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import VueApollo from 'vue-apollo'; import StateActions from '~/terraform/components/states_table_actions.vue'; import lockStateMutation from '~/terraform/graphql/mutations/lock_state.mutation.graphql'; import removeStateMutation from '~/terraform/graphql/mutations/remove_state.mutation.graphql'; diff --git a/spec/frontend/terraform/components/terraform_list_spec.js b/spec/frontend/terraform/components/terraform_list_spec.js index 043fde3be17..20d42ebd4fd 100644 --- a/spec/frontend/terraform/components/terraform_list_spec.js +++ b/spec/frontend/terraform/components/terraform_list_spec.js @@ -1,7 +1,7 @@ import { GlAlert, GlBadge, GlKeysetPagination, GlLoadingIcon, GlTab } from '@gitlab/ui'; import { createLocalVue, shallowMount } from '@vue/test-utils'; -import createMockApollo from 'helpers/mock_apollo_helper'; import VueApollo from 'vue-apollo'; +import createMockApollo from 'helpers/mock_apollo_helper'; import EmptyState from '~/terraform/components/empty_state.vue'; import StatesTable from '~/terraform/components/states_table.vue'; import TerraformList from '~/terraform/components/terraform_list.vue'; diff --git a/spec/frontend/user_lists/components/edit_user_list_spec.js b/spec/frontend/user_lists/components/edit_user_list_spec.js index 958e86ac050..4149a43e06b 100644 --- a/spec/frontend/user_lists/components/edit_user_list_spec.js +++ b/spec/frontend/user_lists/components/edit_user_list_spec.js @@ -7,8 +7,8 @@ import Api from '~/api'; import createStore from '~/user_lists/store/edit'; import EditUserList from '~/user_lists/components/edit_user_list.vue'; import UserListForm from '~/user_lists/components/user_list_form.vue'; -import { userList } from '../../feature_flags/mock_data'; import { redirectTo } from '~/lib/utils/url_utility'; +import { userList } from '../../feature_flags/mock_data'; jest.mock('~/api'); jest.mock('~/lib/utils/url_utility'); 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 85468c5b0db..f4890c857d1 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 @@ -3,8 +3,8 @@ 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 ArtifactsApp from '~/vue_merge_request_widget/components/artifacts_list_app.vue'; -import { mockStore } from '../mock_data'; import axios from '~/lib/utils/axios_utils'; +import { mockStore } from '../mock_data'; describe('MrWidgetPipelineContainer', () => { let wrapper; 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..6ce6253c74d 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,11 +1,10 @@ import { mount, shallowMount } from '@vue/test-utils'; import { GlLink, GlSprintf } from '@gitlab/ui'; -import { mockTracking, triggerEvent, unmockTracking } from 'helpers/tracking_helper'; import MockAdapter from 'axios-mock-adapter'; +import { mockTracking, triggerEvent, unmockTracking } from 'helpers/tracking_helper'; 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 axios from '~/lib/utils/axios_utils'; import { SP_TRACK_LABEL, @@ -15,6 +14,7 @@ import { SP_SHOW_TRACK_VALUE, SP_HELP_URL, } from '~/vue_merge_request_widget/constants'; +import { suggestProps, iconName } from './pipeline_tour_mock_data'; describe('MRWidgetSuggestPipeline', () => { describe('template', () => { 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..d52240b0b2e 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,7 +1,10 @@ import Vue from 'vue'; import mountComponent from 'helpers/vue_mount_component_helper'; +import { getByRole } from '@testing-library/dom'; import mergedComponent from '~/vue_merge_request_widget/components/states/mr_widget_merged.vue'; import eventHub from '~/vue_merge_request_widget/event_hub'; +import modalEventHub from '~/projects/commit/event_hub'; +import { OPEN_REVERT_MODAL } from '~/projects/commit/constants'; describe('MRWidgetMerged', () => { let vm; @@ -16,6 +19,7 @@ describe('MRWidgetMerged', () => { }; beforeEach(() => { + jest.spyOn(document, 'dispatchEvent'); const Component = Vue.extend(mergedComponent); const mr = { isRemovingSourceBranch: false, @@ -147,6 +151,18 @@ 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('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/terraform/mr_widget_terraform_container_spec.js b/spec/frontend/vue_mr_widget/components/terraform/mr_widget_terraform_container_spec.js index 8da0d0f16d6..a9b852b084d 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 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/mr_widget_options_spec.js b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js index 8c8c81cab24..8c642799fb8 100644 --- a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js +++ b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js @@ -11,10 +11,10 @@ import notify from '~/lib/utils/notify'; import SmartInterval from '~/smart_interval'; import { setFaviconOverlay } from '~/lib/utils/favicon'; import { stateKey } from '~/vue_merge_request_widget/stores/state_maps'; -import mockData from './mock_data'; -import { faviconDataUrl, overlayDataUrl } from '../lib/utils/mock_data'; import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/constants'; import securityReportDownloadPathsQuery from '~/vue_shared/security_reports/queries/security_report_download_paths.query.graphql'; +import { faviconDataUrl, overlayDataUrl } from '../lib/utils/mock_data'; +import mockData from './mock_data'; jest.mock('~/smart_interval'); @@ -67,6 +67,7 @@ describe('MrWidgetOptions', () => { describe('default', () => { beforeEach(() => { + jest.spyOn(document, 'dispatchEvent'); return createComponent(); }); @@ -353,6 +354,9 @@ describe('MrWidgetOptions', () => { return nextTick().then(() => { expect(wrapper.vm.service.fetchMergeActionsContent).toHaveBeenCalled(); expect(document.body.textContent).toContain('hello world'); + expect(document.dispatchEvent).toHaveBeenCalledWith( + new CustomEvent('merged:UpdateActions'), + ); }); }); }); diff --git a/spec/frontend/vue_shared/components/color_picker/color_picker_spec.js b/spec/frontend/vue_shared/components/color_picker/color_picker_spec.js index 22e70a77024..d30f36ec63c 100644 --- a/spec/frontend/vue_shared/components/color_picker/color_picker_spec.js +++ b/spec/frontend/vue_shared/components/color_picker/color_picker_spec.js @@ -29,8 +29,6 @@ describe('ColorPicker', () => { '#428BCA': 'Moderate blue', '#44AD8E': 'Lime green', }; - - createComponent(shallowMount); }); afterEach(() => { @@ -39,6 +37,8 @@ describe('ColorPicker', () => { describe('label', () => { it('hides the label if the label is not passed', () => { + createComponent(shallowMount); + expect(label()).toBe(''); }); @@ -60,9 +60,9 @@ describe('ColorPicker', () => { }); it('has a color set on initialization', () => { - createComponent(shallowMount, { setColor }); + createComponent(mount, { value: setColor }); - expect(wrapper.vm.$data.selectedColor).toBe(setColor); + expect(colorInput().props('value')).toBe(setColor); }); it('emits input event from component when a color is selected', async () => { @@ -76,7 +76,7 @@ describe('ColorPicker', () => { createComponent(); await colorInput().setValue(` ${setColor} `); - expect(wrapper.vm.$data.selectedColor).toBe(setColor); + expect(wrapper.emitted().input[0]).toStrictEqual([setColor]); expect(colorPreview().attributes('class')).toContain('gl-inset-border-1-gray-400'); expect(colorInput().attributes('class')).not.toContain('is-invalid'); }); @@ -95,14 +95,14 @@ describe('ColorPicker', () => { createComponent(); await colorInput().setValue(setColor); - expect(wrapper.vm.$data.selectedColor).toBe(setColor); + expect(wrapper.emitted().input[0]).toStrictEqual([setColor]); }); it('has color picker value entered', async () => { createComponent(); await colorPicker().setValue(setColor); - expect(wrapper.vm.$data.selectedColor).toBe(setColor); + expect(wrapper.emitted().input[0]).toStrictEqual([setColor]); }); }); @@ -127,7 +127,7 @@ describe('ColorPicker', () => { createComponent(); await presetColors().at(0).trigger('click'); - expect(wrapper.vm.$data.selectedColor).toBe(setColor); + expect(wrapper.emitted().input[0]).toStrictEqual([setColor]); }); }); }); diff --git a/spec/frontend/vue_shared/components/file_row_spec.js b/spec/frontend/vue_shared/components/file_row_spec.js index bd6a18bf704..92690f6fc37 100644 --- a/spec/frontend/vue_shared/components/file_row_spec.js +++ b/spec/frontend/vue_shared/components/file_row_spec.js @@ -1,6 +1,6 @@ -import { file } from 'jest/ide/helpers'; import { shallowMount } from '@vue/test-utils'; import { nextTick } from 'vue'; +import { file } from 'jest/ide/helpers'; import FileRow from '~/vue_shared/components/file_row.vue'; import FileHeader from '~/vue_shared/components/file_row_header.vue'; import FileIcon from '~/vue_shared/components/file_icon.vue'; diff --git a/spec/frontend/vue_shared/components/gl_countdown_spec.js b/spec/frontend/vue_shared/components/gl_countdown_spec.js index fcc5c0cd310..82d18c7fd3f 100644 --- a/spec/frontend/vue_shared/components/gl_countdown_spec.js +++ b/spec/frontend/vue_shared/components/gl_countdown_spec.js @@ -1,5 +1,5 @@ -import mountComponent from 'helpers/vue_mount_component_helper'; import Vue from 'vue'; +import mountComponent from 'helpers/vue_mount_component_helper'; import GlCountdown from '~/vue_shared/components/gl_countdown.vue'; describe('GlCountdown', () => { diff --git a/spec/frontend/vue_shared/components/issue/issue_milestone_spec.js b/spec/frontend/vue_shared/components/issue/issue_milestone_spec.js index ffcb891c4fc..8143196c6e8 100644 --- a/spec/frontend/vue_shared/components/issue/issue_milestone_spec.js +++ b/spec/frontend/vue_shared/components/issue/issue_milestone_spec.js @@ -1,8 +1,8 @@ import Vue from 'vue'; import { shallowMount } from '@vue/test-utils'; -import { mockMilestone } from 'jest/boards/mock_data'; import { GlIcon } from '@gitlab/ui'; +import { mockMilestone } from 'jest/boards/mock_data'; import IssueMilestone from '~/vue_shared/components/issue/issue_milestone.vue'; const createComponent = (milestone = mockMilestone) => { diff --git a/spec/frontend/vue_shared/components/markdown/field_spec.js b/spec/frontend/vue_shared/components/markdown/field_spec.js index a2ce6f40193..97cc22e1418 100644 --- a/spec/frontend/vue_shared/components/markdown/field_spec.js +++ b/spec/frontend/vue_shared/components/markdown/field_spec.js @@ -1,7 +1,7 @@ import { mount } from '@vue/test-utils'; -import { TEST_HOST, FIXTURES_PATH } from 'spec/test_constants'; import AxiosMockAdapter from 'axios-mock-adapter'; import $ from 'jquery'; +import { TEST_HOST, FIXTURES_PATH } from 'spec/test_constants'; import MarkdownField from '~/vue_shared/components/markdown/field.vue'; import axios from '~/lib/utils/axios_utils'; diff --git a/spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js b/spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js index 0e6f951bd53..594b1ab9d78 100644 --- a/spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js +++ b/spec/frontend/vue_shared/components/rich_content_editor/toolbar_item_spec.js @@ -1,6 +1,6 @@ import { shallowMount } from '@vue/test-utils'; -import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { GlIcon } from '@gitlab/ui'; +import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import ToolbarItem from '~/vue_shared/components/rich_content_editor/toolbar_item.vue'; describe('Toolbar Item', () => { diff --git a/spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js b/spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js index d151cd15bc4..3eae707daf8 100644 --- a/spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js +++ b/spec/frontend/vue_shared/components/user_avatar/user_avatar_link_spec.js @@ -1,7 +1,7 @@ import { each } from 'lodash'; -import { trimText } from 'helpers/text_helper'; import { shallowMount } from '@vue/test-utils'; import { GlLink } from '@gitlab/ui'; +import { trimText } from 'helpers/text_helper'; import { TEST_HOST } from 'spec/test_constants'; import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import UserAvatarImage from '~/vue_shared/components/user_avatar/user_avatar_image.vue'; diff --git a/spec/frontend/vue_shared/security_reports/security_reports_app_spec.js b/spec/frontend/vue_shared/security_reports/security_reports_app_spec.js index 434b66379ea..bd66142ab9e 100644 --- a/spec/frontend/vue_shared/security_reports/security_reports_app_spec.js +++ b/spec/frontend/vue_shared/security_reports/security_reports_app_spec.js @@ -1,6 +1,7 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; import { merge } from 'lodash'; +import Vue from 'vue'; import VueApollo from 'vue-apollo'; import Vuex from 'vuex'; import createMockApollo from 'helpers/mock_apollo_helper'; @@ -26,8 +27,8 @@ import securityReportDownloadPathsQuery from '~/vue_shared/security_reports/quer jest.mock('~/flash'); -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(VueApollo); +Vue.use(Vuex); const SAST_COMPARISON_PATH = '/sast.json'; const SECRET_SCANNING_COMPARISON_PATH = '/secret_detection.json'; @@ -47,7 +48,6 @@ describe('Security reports app', () => { SecurityReportsApp, merge( { - localVue, propsData: { ...props }, stubs: { HelpIcon: true, @@ -64,8 +64,6 @@ describe('Security reports app', () => { Promise.resolve({ data: securityReportDownloadPathsQueryNoArtifactsResponse }); const failureHandler = () => Promise.resolve({ errors: [{ message: 'some error' }] }); const createMockApolloProvider = (handler) => { - localVue.use(VueApollo); - const requestHandlers = [[securityReportDownloadPathsQuery, handler]]; return createMockApollo(requestHandlers); diff --git a/spec/frontend/whats_new/store/actions_spec.js b/spec/frontend/whats_new/store/actions_spec.js index 82f17a2726f..b5e0b2a0364 100644 --- a/spec/frontend/whats_new/store/actions_spec.js +++ b/spec/frontend/whats_new/store/actions_spec.js @@ -1,6 +1,6 @@ +import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; import { useLocalStorageSpy } from 'helpers/local_storage_helper'; -import MockAdapter from 'axios-mock-adapter'; import waitForPromises from 'helpers/wait_for_promises'; import actions from '~/whats_new/store/actions'; import * as types from '~/whats_new/store/mutation_types'; |