diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-09 03:07:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-09 03:07:49 +0300 |
commit | de19091107816cd08b0b83f7d908776e71a43606 (patch) | |
tree | f63ae746b17fe5f95f72f111494e949a12acf6db /spec/frontend | |
parent | 6cb5b3a92d526e8b675aba2d1455e7e00b8656f5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
28 files changed, 72 insertions, 113 deletions
diff --git a/spec/frontend/admin/broadcast_messages/components/base_spec.js b/spec/frontend/admin/broadcast_messages/components/base_spec.js index d69bf4a22bf..13619f536c8 100644 --- a/spec/frontend/admin/broadcast_messages/components/base_spec.js +++ b/spec/frontend/admin/broadcast_messages/components/base_spec.js @@ -4,7 +4,7 @@ import AxiosMockAdapter from 'axios-mock-adapter'; import { TEST_HOST } from 'helpers/test_constants'; import waitForPromises from 'helpers/wait_for_promises'; import { useMockLocationHelper } from 'helpers/mock_window_location_helper'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import axios from '~/lib/utils/axios_utils'; import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { redirectTo } from '~/lib/utils/url_utility'; @@ -12,7 +12,7 @@ import BroadcastMessagesBase from '~/admin/broadcast_messages/components/base.vu import MessagesTable from '~/admin/broadcast_messages/components/messages_table.vue'; import { generateMockMessages, MOCK_MESSAGES } from '../mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); jest.mock('~/lib/utils/url_utility'); describe('BroadcastMessagesBase', () => { diff --git a/spec/frontend/admin/broadcast_messages/components/message_form_spec.js b/spec/frontend/admin/broadcast_messages/components/message_form_spec.js index 36c0ac303ba..292575c984b 100644 --- a/spec/frontend/admin/broadcast_messages/components/message_form_spec.js +++ b/spec/frontend/admin/broadcast_messages/components/message_form_spec.js @@ -1,7 +1,7 @@ import { mount } from '@vue/test-utils'; import { GlBroadcastMessage, GlForm } from '@gitlab/ui'; import AxiosMockAdapter from 'axios-mock-adapter'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import axios from '~/lib/utils/axios_utils'; import { HTTP_STATUS_BAD_REQUEST } from '~/lib/utils/http_status'; import MessageForm from '~/admin/broadcast_messages/components/message_form.vue'; @@ -15,7 +15,7 @@ import waitForPromises from 'helpers/wait_for_promises'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { MOCK_TARGET_ACCESS_LEVELS } from '../mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('MessageForm', () => { let wrapper; diff --git a/spec/frontend/admin/deploy_keys/components/table_spec.js b/spec/frontend/admin/deploy_keys/components/table_spec.js index 4d4a2caedde..ef5796f634b 100644 --- a/spec/frontend/admin/deploy_keys/components/table_spec.js +++ b/spec/frontend/admin/deploy_keys/components/table_spec.js @@ -9,10 +9,10 @@ import { stubComponent } from 'helpers/stub_component'; import DeployKeysTable from '~/admin/deploy_keys/components/table.vue'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import Api, { DEFAULT_PER_PAGE } from '~/api'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; jest.mock('~/api'); -jest.mock('~/flash'); +jest.mock('~/alert'); jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' })); describe('DeployKeysTable', () => { @@ -242,7 +242,7 @@ describe('DeployKeysTable', () => { itRendersTheEmptyState(); - it('displays flash', () => { + it('displays alert', () => { expect(createAlert).toHaveBeenCalledWith({ message: DeployKeysTable.i18n.apiErrorMessage, captureError: true, diff --git a/spec/frontend/admin/users/components/users_table_spec.js b/spec/frontend/admin/users/components/users_table_spec.js index a0aec347b6b..3d3cdadb382 100644 --- a/spec/frontend/admin/users/components/users_table_spec.js +++ b/spec/frontend/admin/users/components/users_table_spec.js @@ -10,12 +10,12 @@ import AdminUserActions from '~/admin/users/components/user_actions.vue'; import AdminUserAvatar from '~/admin/users/components/user_avatar.vue'; import AdminUsersTable from '~/admin/users/components/users_table.vue'; import getUsersGroupCountsQuery from '~/admin/users/graphql/queries/get_users_group_counts.query.graphql'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import AdminUserDate from '~/vue_shared/components/user_date.vue'; import { users, paths, createGroupCountResponse } from '../mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); Vue.use(VueApollo); @@ -134,7 +134,7 @@ describe('AdminUsersTable component', () => { await waitForPromises(); }); - it('creates a flash message and captures the error', () => { + it('creates an alert message and captures the error', () => { expect(createAlert).toHaveBeenCalledWith({ message: 'Could not load user group counts. Please refresh the page to try again.', captureError: true, diff --git a/spec/frontend/analytics/cycle_analytics/base_spec.js b/spec/frontend/analytics/cycle_analytics/base_spec.js index f27c3746c76..978970d1526 100644 --- a/spec/frontend/analytics/cycle_analytics/base_spec.js +++ b/spec/frontend/analytics/cycle_analytics/base_spec.js @@ -31,13 +31,14 @@ Vue.use(Vuex); let wrapper; -const { id: groupId, path: groupPath } = currentGroup; +const { path } = currentGroup; +const groupPath = `groups/${path}`; const defaultState = { currentGroup, createdBefore, createdAfter, stageCounts, - endpoints: { fullPath, groupId, groupPath }, + endpoints: { fullPath, groupPath }, }; function createStore({ initialState = {}, initialGetters = {} }) { @@ -139,7 +140,6 @@ describe('Value stream analytics component', () => { it('passes the paths to the filter bar', () => { expect(findFilters().props()).toEqual({ - groupId, groupPath, endDate: createdBefore, hasDateRangeFilter: true, diff --git a/spec/frontend/analytics/cycle_analytics/utils_spec.js b/spec/frontend/analytics/cycle_analytics/utils_spec.js index a79abff1dff..25edd5af622 100644 --- a/spec/frontend/analytics/cycle_analytics/utils_spec.js +++ b/spec/frontend/analytics/cycle_analytics/utils_spec.js @@ -91,7 +91,6 @@ describe('Value stream analytics utils', () => { const projectId = '5'; const createdAfter = '2021-09-01'; const createdBefore = '2021-11-06'; - const groupId = '146'; const groupPath = 'fake-group'; const fullPath = 'fake-group/fake-project'; const labelsPath = '/fake-group/fake-project/-/labels.json'; @@ -106,7 +105,6 @@ describe('Value stream analytics utils', () => { requestPath, labelsPath, milestonesPath, - groupId, groupPath, }; @@ -130,8 +128,7 @@ describe('Value stream analytics utils', () => { expect(endpoints.requestPath).toBe(requestPath); expect(endpoints.labelsPath).toBe(labelsPath); expect(endpoints.milestonesPath).toBe(milestonesPath); - expect(endpoints.groupId).toBe(parseInt(groupId, 10)); - expect(endpoints.groupPath).toBe(groupPath); + expect(endpoints.groupPath).toBe(`groups/${groupPath}`); }); it('returns null when there is no stage', () => { diff --git a/spec/frontend/analytics/shared/utils_spec.js b/spec/frontend/analytics/shared/utils_spec.js index 0b4346de9dc..e020ff999fc 100644 --- a/spec/frontend/analytics/shared/utils_spec.js +++ b/spec/frontend/analytics/shared/utils_spec.js @@ -216,11 +216,11 @@ describe('prepareTimeMetricsData', () => { describe('generateValueStreamsDashboardLink', () => { it.each` - groupPath | projectPaths | result - ${''} | ${[]} | ${''} - ${'fake-group'} | ${[]} | ${'/groups/fake-group/-/analytics/dashboards'} - ${'fake-group'} | ${['fake-path/project_1']} | ${'/groups/fake-group/-/analytics/dashboards?query=fake-path/project_1'} - ${'fake-group'} | ${['fake-path/project_1', 'fake-path/project_2']} | ${'/groups/fake-group/-/analytics/dashboards?query=fake-path/project_1,fake-path/project_2'} + groupPath | projectPaths | result + ${''} | ${[]} | ${''} + ${'groups/fake-group'} | ${[]} | ${'/groups/fake-group/-/analytics/dashboards'} + ${'groups/fake-group'} | ${['fake-path/project_1']} | ${'/groups/fake-group/-/analytics/dashboards?query=fake-path/project_1'} + ${'groups/fake-group'} | ${['fake-path/project_1', 'fake-path/project_2']} | ${'/groups/fake-group/-/analytics/dashboards?query=fake-path/project_1,fake-path/project_2'} `( 'generates the dashboard link when groupPath=$groupPath and projectPaths=$projectPaths', ({ groupPath, projectPaths, result }) => { @@ -234,7 +234,7 @@ describe('generateValueStreamsDashboardLink', () => { }); it('with includes a relative path if one is set', () => { - expect(generateValueStreamsDashboardLink('fake-path', ['project_1'])).toBe( + expect(generateValueStreamsDashboardLink('groups/fake-path', ['project_1'])).toBe( '/foobar/groups/fake-path/-/analytics/dashboards?query=project_1', ); }); diff --git a/spec/frontend/ci/ci_variable_list/components/ci_variable_shared_spec.js b/spec/frontend/ci/ci_variable_list/components/ci_variable_shared_spec.js index 6e6ef7e9a8a..87192006efc 100644 --- a/spec/frontend/ci/ci_variable_list/components/ci_variable_shared_spec.js +++ b/spec/frontend/ci/ci_variable_list/components/ci_variable_shared_spec.js @@ -4,7 +4,7 @@ import { GlLoadingIcon, GlTable } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import { resolvers } from '~/ci/ci_variable_list/graphql/settings'; import { TYPENAME_GROUP } from '~/graphql_shared/constants'; import { convertToGraphQLId } from '~/graphql_shared/utils'; @@ -41,7 +41,7 @@ import { mockAdminVariables, } from '../mocks'; -jest.mock('~/flash'); +jest.mock('~/alert'); Vue.use(VueApollo); diff --git a/spec/frontend/ci/pipeline_new/components/refs_dropdown_spec.js b/spec/frontend/ci/pipeline_new/components/refs_dropdown_spec.js index cf8009e388f..bec9e6947f3 100644 --- a/spec/frontend/ci/pipeline_new/components/refs_dropdown_spec.js +++ b/spec/frontend/ci/pipeline_new/components/refs_dropdown_spec.js @@ -13,7 +13,7 @@ const projectRefsEndpoint = '/root/project/refs'; const refShortName = 'main'; const refFullName = 'refs/heads/main'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('Pipeline New Form', () => { let wrapper; diff --git a/spec/frontend/ci/runner/admin_runners/admin_runners_app_spec.js b/spec/frontend/ci/runner/admin_runners/admin_runners_app_spec.js index 7fc240e520b..39ec24f38d5 100644 --- a/spec/frontend/ci/runner/admin_runners/admin_runners_app_spec.js +++ b/spec/frontend/ci/runner/admin_runners/admin_runners_app_spec.js @@ -9,7 +9,7 @@ import { mountExtended, } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import { s__ } from '~/locale'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { updateHistory } from '~/lib/utils/url_utility'; @@ -70,7 +70,7 @@ const mockRunnersCount = runnersCountData.data.runners.count; const mockRunnersHandler = jest.fn(); const mockRunnersCountHandler = jest.fn(); -jest.mock('~/flash'); +jest.mock('~/alert'); jest.mock('~/ci/runner/sentry_utils'); jest.mock('~/lib/utils/url_utility', () => ({ ...jest.requireActual('~/lib/utils/url_utility'), diff --git a/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js b/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js index 39ea5cade28..9f4ac68a4e9 100644 --- a/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js +++ b/spec/frontend/ci/runner/group_runners/group_runners_app_spec.js @@ -9,7 +9,7 @@ import { mountExtended, } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import { s__ } from '~/locale'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { updateHistory } from '~/lib/utils/url_utility'; @@ -74,7 +74,7 @@ const mockGroupRunnersCount = mockGroupRunnersEdges.length; const mockGroupRunnersHandler = jest.fn(); const mockGroupRunnersCountHandler = jest.fn(); -jest.mock('~/flash'); +jest.mock('~/alert'); jest.mock('~/ci/runner/sentry_utils'); jest.mock('~/lib/utils/url_utility', () => ({ ...jest.requireActual('~/lib/utils/url_utility'), diff --git a/spec/frontend/ci/runner/runner_edit/runner_edit_app_spec.js b/spec/frontend/ci/runner/runner_edit/runner_edit_app_spec.js index a9369a5e626..477eb1a8fdf 100644 --- a/spec/frontend/ci/runner/runner_edit/runner_edit_app_spec.js +++ b/spec/frontend/ci/runner/runner_edit/runner_edit_app_spec.js @@ -3,7 +3,7 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import RunnerHeader from '~/ci/runner/components/runner_header.vue'; @@ -15,7 +15,7 @@ import { I18N_STATUS_NEVER_CONTACTED, I18N_INSTANCE_TYPE } from '~/ci/runner/con import { runnerFormData } from '../mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); jest.mock('~/ci/runner/sentry_utils'); const mockRunner = runnerFormData.data.runner; diff --git a/spec/frontend/environments/delete_environment_modal_spec.js b/spec/frontend/environments/delete_environment_modal_spec.js index cc18bf754eb..96f6ce52a9c 100644 --- a/spec/frontend/environments/delete_environment_modal_spec.js +++ b/spec/frontend/environments/delete_environment_modal_spec.js @@ -6,10 +6,10 @@ import { s__, sprintf } from '~/locale'; import DeleteEnvironmentModal from '~/environments/components/delete_environment_modal.vue'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import { resolvedEnvironment } from './graphql/mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); Vue.use(VueApollo); describe('~/environments/components/delete_environment_modal.vue', () => { @@ -67,7 +67,7 @@ describe('~/environments/components/delete_environment_modal.vue', () => { ); }); - it('should flash a message on error', async () => { + it('should alert a message on error', async () => { createComponent({ apolloProvider: mockApollo }); deleteResolver.mockRejectedValue(); diff --git a/spec/frontend/environments/edit_environment_spec.js b/spec/frontend/environments/edit_environment_spec.js index fb1a8b8c00a..956d68a14f3 100644 --- a/spec/frontend/environments/edit_environment_spec.js +++ b/spec/frontend/environments/edit_environment_spec.js @@ -3,13 +3,13 @@ import MockAdapter from 'axios-mock-adapter'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; import EditEnvironment from '~/environments/components/edit_environment.vue'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import axios from '~/lib/utils/axios_utils'; import { HTTP_STATUS_BAD_REQUEST, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { visitUrl } from '~/lib/utils/url_utility'; jest.mock('~/lib/utils/url_utility'); -jest.mock('~/flash'); +jest.mock('~/alert'); const DEFAULT_OPTS = { provide: { diff --git a/spec/frontend/environments/new_environment_spec.js b/spec/frontend/environments/new_environment_spec.js index a8cc05b297b..257bf76baba 100644 --- a/spec/frontend/environments/new_environment_spec.js +++ b/spec/frontend/environments/new_environment_spec.js @@ -3,13 +3,13 @@ import MockAdapter from 'axios-mock-adapter'; import { mountExtended } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; import NewEnvironment from '~/environments/components/new_environment.vue'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import axios from '~/lib/utils/axios_utils'; import { HTTP_STATUS_BAD_REQUEST, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { visitUrl } from '~/lib/utils/url_utility'; jest.mock('~/lib/utils/url_utility'); -jest.mock('~/flash'); +jest.mock('~/alert'); const DEFAULT_OPTS = { provide: { diff --git a/spec/frontend/operation_settings/components/metrics_settings_spec.js b/spec/frontend/operation_settings/components/metrics_settings_spec.js index 732dfdd42fb..ee450dfc851 100644 --- a/spec/frontend/operation_settings/components/metrics_settings_spec.js +++ b/spec/frontend/operation_settings/components/metrics_settings_spec.js @@ -2,7 +2,7 @@ import { GlButton, GlLink, GlFormGroup, GlFormInput, GlFormSelect } from '@gitla import { mount, shallowMount } from '@vue/test-utils'; import { nextTick } from 'vue'; import { TEST_HOST } from 'helpers/test_constants'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import axios from '~/lib/utils/axios_utils'; import { refreshCurrentPage } from '~/lib/utils/url_utility'; import { timezones } from '~/monitoring/format_date'; @@ -13,7 +13,7 @@ import MetricsSettings from '~/operation_settings/components/metrics_settings.vu import store from '~/operation_settings/store'; jest.mock('~/lib/utils/url_utility'); -jest.mock('~/flash'); +jest.mock('~/alert'); describe('operation settings external dashboard component', () => { let wrapper; @@ -198,7 +198,7 @@ describe('operation settings external dashboard component', () => { expect(refreshCurrentPage).toHaveBeenCalled(); }); - it('creates flash banner on error', async () => { + it('creates alert banner on error', async () => { mountComponent(false); const message = 'mockErrorMessage'; axios.patch.mockRejectedValue({ response: { data: { message } } }); diff --git a/spec/frontend/projects/commit/store/actions_spec.js b/spec/frontend/projects/commit/store/actions_spec.js index 1502985cfc7..d48f9fd6fc0 100644 --- a/spec/frontend/projects/commit/store/actions_spec.js +++ b/spec/frontend/projects/commit/store/actions_spec.js @@ -1,6 +1,6 @@ import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import axios from '~/lib/utils/axios_utils'; import { PROJECT_BRANCHES_ERROR } from '~/projects/commit/constants'; import * as actions from '~/projects/commit/store/actions'; @@ -8,7 +8,7 @@ import * as types from '~/projects/commit/store/mutation_types'; import getInitialState from '~/projects/commit/store/state'; import mockData from '../mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('Commit form modal store actions', () => { let axiosMock; @@ -63,7 +63,7 @@ describe('Commit form modal store actions', () => { ); }); - it('should show flash error and set error in state on fetchBranches failure', async () => { + it('should show alert error and set error in state on fetchBranches failure', async () => { jest.spyOn(axios, 'get').mockRejectedValue(); await testAction(actions.fetchBranches, {}, state, [], [{ type: 'requestBranches' }]); diff --git a/spec/frontend/projects/commits/store/actions_spec.js b/spec/frontend/projects/commits/store/actions_spec.js index bae9c48fc1e..f5184e59420 100644 --- a/spec/frontend/projects/commits/store/actions_spec.js +++ b/spec/frontend/projects/commits/store/actions_spec.js @@ -1,13 +1,13 @@ import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import testAction from 'helpers/vuex_action_helper'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import actions from '~/projects/commits/store/actions'; import * as types from '~/projects/commits/store/mutation_types'; import createState from '~/projects/commits/store/state'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('Project commits actions', () => { let state; @@ -34,8 +34,8 @@ describe('Project commits actions', () => { ])); }); - describe('shows a flash message when there is an error', () => { - it('creates a flash', () => { + describe('shows an alert message when there is an error', () => { + it('creates an alert', () => { const mockDispatchContext = { dispatch: () => {}, commit: () => {}, state }; actions.receiveAuthorsError(mockDispatchContext); diff --git a/spec/frontend/projects/compare/components/revision_dropdown_legacy_spec.js b/spec/frontend/projects/compare/components/revision_dropdown_legacy_spec.js index 2304e936dc6..892e43afd94 100644 --- a/spec/frontend/projects/compare/components/revision_dropdown_legacy_spec.js +++ b/spec/frontend/projects/compare/components/revision_dropdown_legacy_spec.js @@ -2,7 +2,7 @@ import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import AxiosMockAdapter from 'axios-mock-adapter'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import axios from '~/lib/utils/axios_utils'; import { HTTP_STATUS_NOT_FOUND, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import RevisionDropdown from '~/projects/compare/components/revision_dropdown_legacy.vue'; @@ -14,7 +14,7 @@ const defaultProps = { paramsBranch: 'main', }; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('RevisionDropdown component', () => { let wrapper; @@ -91,7 +91,7 @@ describe('RevisionDropdown component', () => { expect(findTagsDropdownItem()).toHaveLength(0); }); - it('shows flash message on error', async () => { + it('shows alert message on error', async () => { axiosMock.onGet('some/invalid/path').replyOnce(HTTP_STATUS_NOT_FOUND); await waitForPromises(); diff --git a/spec/frontend/projects/compare/components/revision_dropdown_spec.js b/spec/frontend/projects/compare/components/revision_dropdown_spec.js index 50779063d6b..455cd84afd4 100644 --- a/spec/frontend/projects/compare/components/revision_dropdown_spec.js +++ b/spec/frontend/projects/compare/components/revision_dropdown_spec.js @@ -3,13 +3,13 @@ import { shallowMount } from '@vue/test-utils'; import AxiosMockAdapter from 'axios-mock-adapter'; import { nextTick } from 'vue'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import axios from '~/lib/utils/axios_utils'; import { HTTP_STATUS_NOT_FOUND, HTTP_STATUS_OK } from '~/lib/utils/http_status'; import RevisionDropdown from '~/projects/compare/components/revision_dropdown.vue'; import { revisionDropdownDefaultProps as defaultProps } from './mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('RevisionDropdown component', () => { let wrapper; @@ -79,7 +79,7 @@ describe('RevisionDropdown component', () => { }); }); - it('shows flash message on error', async () => { + it('shows alert message on error', async () => { axiosMock.onGet('some/invalid/path').replyOnce(HTTP_STATUS_NOT_FOUND); createComponent(); @@ -105,7 +105,7 @@ describe('RevisionDropdown component', () => { }); describe('search', () => { - it('shows flash message on error', async () => { + it('shows alert message on error', async () => { axiosMock.onGet('some/invalid/path').replyOnce(HTTP_STATUS_NOT_FOUND); createComponent(); diff --git a/spec/frontend/projects/settings/branch_rules/components/edit/branch_dropdown_spec.js b/spec/frontend/projects/settings/branch_rules/components/edit/branch_dropdown_spec.js index 11f219c1f90..12b92db9427 100644 --- a/spec/frontend/projects/settings/branch_rules/components/edit/branch_dropdown_spec.js +++ b/spec/frontend/projects/settings/branch_rules/components/edit/branch_dropdown_spec.js @@ -8,10 +8,10 @@ import BranchDropdown, { import createMockApollo from 'helpers/mock_apollo_helper'; import branchesQuery from '~/projects/settings/branch_rules/queries/branches.query.graphql'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; Vue.use(VueApollo); -jest.mock('~/flash'); +jest.mock('~/alert'); describe('Branch dropdown', () => { let wrapper; diff --git a/spec/frontend/projects/settings/components/shared_runners_toggle_spec.js b/spec/frontend/projects/settings/components/shared_runners_toggle_spec.js index f82ad80135e..e53b6b76534 100644 --- a/spec/frontend/projects/settings/components/shared_runners_toggle_spec.js +++ b/spec/frontend/projects/settings/components/shared_runners_toggle_spec.js @@ -9,7 +9,7 @@ import SharedRunnersToggleComponent from '~/projects/settings/components/shared_ const TEST_UPDATE_PATH = '/test/update_shared_runners'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('projects/settings/components/shared_runners', () => { let wrapper; diff --git a/spec/frontend/projects/settings/repository/branch_rules/app_spec.js b/spec/frontend/projects/settings/repository/branch_rules/app_spec.js index 661f842066e..dd534bec25d 100644 --- a/spec/frontend/projects/settings/repository/branch_rules/app_spec.js +++ b/spec/frontend/projects/settings/repository/branch_rules/app_spec.js @@ -7,7 +7,7 @@ import { mountExtended } from 'helpers/vue_test_utils_helper'; import BranchRules from '~/projects/settings/repository/branch_rules/app.vue'; import BranchRule from '~/projects/settings/repository/branch_rules/components/branch_rule.vue'; import branchRulesQuery from 'ee_else_ce/projects/settings/repository/branch_rules/graphql/queries/branch_rules.query.graphql'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import { branchRulesMockResponse, appProvideMock, @@ -22,7 +22,7 @@ import { expandSection } from '~/settings_panels'; import { scrollToElement } from '~/lib/utils/common_utils'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; -jest.mock('~/flash'); +jest.mock('~/alert'); jest.mock('~/settings_panels'); jest.mock('~/lib/utils/common_utils'); diff --git a/spec/frontend/work_items/components/work_item_detail_spec.js b/spec/frontend/work_items/components/work_item_detail_spec.js index 38e1903ad47..6984e385e42 100644 --- a/spec/frontend/work_items/components/work_item_detail_spec.js +++ b/spec/frontend/work_items/components/work_item_detail_spec.js @@ -101,7 +101,6 @@ describe('WorkItemDetail component', () => { error = undefined, workItemsMvcEnabled = false, workItemsMvc2Enabled = false, - fetchByIid = false, } = {}) => { const handlers = [ [workItemQuery, handler], @@ -126,7 +125,6 @@ describe('WorkItemDetail component', () => { glFeatures: { workItemsMvc: workItemsMvcEnabled, workItemsMvc2: workItemsMvc2Enabled, - useIidInWorkItemsPath: fetchByIid, }, hasIssueWeightsFeature: true, hasIterationsFeature: true, @@ -637,7 +635,7 @@ describe('WorkItemDetail component', () => { }); }); - it('calls the global ID work item query when `useIidInWorkItemsPath` feature flag is false', async () => { + it('calls the global ID work item query when there is no `iid_path` parameter in URL', async () => { createComponent(); await waitForPromises(); @@ -647,20 +645,10 @@ describe('WorkItemDetail component', () => { expect(successByIidHandler).not.toHaveBeenCalled(); }); - it('calls the global ID work item query when `useIidInWorkItemsPath` feature flag is true but there is no `iid_path` parameter in URL', async () => { - createComponent({ fetchByIid: true }); - await waitForPromises(); - - expect(successHandler).toHaveBeenCalledWith({ - id: workItemQueryResponse.data.workItem.id, - }); - expect(successByIidHandler).not.toHaveBeenCalled(); - }); - - it('calls the IID work item query when `useIidInWorkItemsPath` feature flag is true and `iid_path` route parameter is present', async () => { + it('calls the IID work item query when `iid_path` route parameter is present', async () => { setWindowLocation(`?iid_path=true`); - createComponent({ fetchByIid: true, iidPathQueryParam: 'true' }); + createComponent(); await waitForPromises(); expect(successHandler).not.toHaveBeenCalled(); @@ -670,10 +658,10 @@ describe('WorkItemDetail component', () => { }); }); - it('calls the IID work item query when `useIidInWorkItemsPath` feature flag is true and `iid_path` route parameter is present and is a modal', async () => { + it('calls the IID work item query when `iid_path` route parameter is present and is a modal', async () => { setWindowLocation(`?iid_path=true`); - createComponent({ fetchByIid: true, iidPathQueryParam: 'true', isModal: true }); + createComponent({ isModal: true }); await waitForPromises(); expect(successHandler).not.toHaveBeenCalled(); diff --git a/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js b/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js index 26446dc5451..254d94bab28 100644 --- a/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js +++ b/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js @@ -109,7 +109,9 @@ describe('WorkItemLinkChild', () => { }); it('renders item title', () => { - expect(titleEl.attributes('href')).toBe('/gitlab-org/gitlab-test/-/work_items/4'); + expect(titleEl.attributes('href')).toBe( + '/gitlab-org/gitlab-test/-/work_items/4?iid_path=true', + ); expect(titleEl.text()).toBe(workItemTask.title); }); diff --git a/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js b/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js index 563f2c7f716..99e44b4d89c 100644 --- a/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js +++ b/spec/frontend/work_items/components/work_item_links/work_item_links_spec.js @@ -54,7 +54,6 @@ describe('WorkItemLinks', () => { mutationHandler = mutationChangeParentHandler, issueDetailsQueryHandler = jest.fn().mockResolvedValue(getIssueDetailsResponse()), hasIterationsFeature = false, - fetchByIid = false, } = {}) => { mockApollo = createMockApollo( [ @@ -77,9 +76,6 @@ describe('WorkItemLinks', () => { provide: { projectPath: 'project/path', hasIterationsFeature, - glFeatures: { - useIidInWorkItemsPath: fetchByIid, - }, }, propsData: { issuableId: 1 }, apolloProvider: mockApollo, @@ -350,7 +346,7 @@ describe('WorkItemLinks', () => { beforeEach(async () => { setWindowLocation('?iid_path=true'); - await createComponent({ fetchByIid: true }); + await createComponent(); firstChild = findFirstWorkItemLinkChild(); }); @@ -390,7 +386,7 @@ describe('WorkItemLinks', () => { it('starts prefetching work item by iid if URL contains work item id', async () => { setWindowLocation('?work_item_iid=5&iid_path=true'); - await createComponent({ fetchByIid: true }); + await createComponent(); expect(childWorkItemByIidHandler).toHaveBeenCalledWith({ iid: '5', @@ -401,7 +397,7 @@ describe('WorkItemLinks', () => { it('does not open the modal if work item iid URL parameter is not found in child items', async () => { setWindowLocation('?work_item_iid=555&iid_path=true'); - await createComponent({ fetchByIid: true }); + await createComponent(); expect(showModal).not.toHaveBeenCalled(); expect(wrapper.findComponent(WorkItemDetailModal).props('workItemIid')).toBe(null); @@ -409,7 +405,7 @@ describe('WorkItemLinks', () => { it('opens the modal if work item iid URL parameter is found in child items', async () => { setWindowLocation('?work_item_iid=2&iid_path=true'); - await createComponent({ fetchByIid: true }); + await createComponent(); expect(showModal).toHaveBeenCalled(); expect(wrapper.findComponent(WorkItemDetailModal).props('workItemIid')).toBe('2'); diff --git a/spec/frontend/work_items/components/work_item_notes_spec.js b/spec/frontend/work_items/components/work_item_notes_spec.js index 09d0022fa1e..a067923b9fc 100644 --- a/spec/frontend/work_items/components/work_item_notes_spec.js +++ b/spec/frontend/work_items/components/work_item_notes_spec.js @@ -113,11 +113,6 @@ describe('WorkItemNotes component', () => { fetchByIid, workItemType: 'task', }, - provide: { - glFeatures: { - useIidInWorkItemsPath: fetchByIid, - }, - }, stubs: { GlModal: stubComponent(GlModal, { methods: { show: showModal } }), }, diff --git a/spec/frontend/work_items/pages/create_work_item_spec.js b/spec/frontend/work_items/pages/create_work_item_spec.js index 387c8a355fa..0a168f1ade5 100644 --- a/spec/frontend/work_items/pages/create_work_item_spec.js +++ b/spec/frontend/work_items/pages/create_work_item_spec.js @@ -37,7 +37,6 @@ describe('Create work item component', () => { props = {}, queryHandler = querySuccessHandler, mutationHandler = createWorkItemSuccessHandler, - fetchByIid = false, } = {}) => { fakeApollo = createMockApollo( [ @@ -66,9 +65,6 @@ describe('Create work item component', () => { }, provide: { fullPath: 'full-path', - glFeatures: { - useIidInWorkItemsPath: fetchByIid, - }, }, }); }; @@ -109,9 +105,8 @@ describe('Create work item component', () => { expect(wrapper.vm.$router.push).toHaveBeenCalledWith({ name: 'workItem', - params: { - id: '1', - }, + params: { id: '1' }, + query: { iid_path: 'true' }, }); }); @@ -210,18 +205,4 @@ describe('Create work item component', () => { 'Something went wrong when creating work item. Please try again.', ); }); - - it('performs a correct redirect when `useIidInWorkItemsPath` feature flag is enabled', async () => { - createComponent({ fetchByIid: true }); - findTitleInput().vm.$emit('title-input', 'Test title'); - - wrapper.find('form').trigger('submit'); - await waitForPromises(); - - expect(wrapper.vm.$router.push).toHaveBeenCalledWith({ - name: 'workItem', - params: { id: '1' }, - query: { iid_path: 'true' }, - }); - }); }); |