diff --git a/spec/frontend/api_spec.js b/spec/frontend/api_spec.js index 6fd106502c4e409467fc70277c147e59696126be..27385d00717775e1370c2632287e93d824ab16fd 100644 --- a/spec/frontend/api_spec.js +++ b/spec/frontend/api_spec.js @@ -10,8 +10,6 @@ import { HTTP_STATUS_OK, } from '~/lib/utils/http_status'; -jest.mock('~/flash'); - describe('Api', () => { const dummyApiVersion = 'v3000'; const dummyUrlRoot = '/gitlab'; diff --git a/spec/frontend/blame/blame_redirect_spec.js b/spec/frontend/blame/blame_redirect_spec.js index beb10139b3af3dbb3a1aef863b357ef03ae5c528..326f60a5b1369d851ec16d0db338f426b0dfc113 100644 --- a/spec/frontend/blame/blame_redirect_spec.js +++ b/spec/frontend/blame/blame_redirect_spec.js @@ -1,8 +1,8 @@ import redirectToCorrectPage from '~/blame/blame_redirect'; import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('Blame page redirect', () => { beforeEach(() => { diff --git a/spec/frontend/boards/stores/actions_spec.js b/spec/frontend/boards/stores/actions_spec.js index 13eb3865354c4ade23f2d0b3ac17f1995404d4ae..f430062bb73b346e0de256ebda287c63adc1a756 100644 --- a/spec/frontend/boards/stores/actions_spec.js +++ b/spec/frontend/boards/stores/actions_spec.js @@ -43,7 +43,7 @@ import { mockMilestones, } from '../mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); // We need this helper to make sure projectPath is including // subgroups when the movIssue action is called. diff --git a/spec/frontend/clusters_list/store/actions_spec.js b/spec/frontend/clusters_list/store/actions_spec.js index a2e2db3dcc26a53e2c018552f79fa337d7182bfa..6d23db0517dee1e42268f58d2ace903ac597c119 100644 --- a/spec/frontend/clusters_list/store/actions_spec.js +++ b/spec/frontend/clusters_list/store/actions_spec.js @@ -5,13 +5,13 @@ import waitForPromises from 'helpers/wait_for_promises'; import { MAX_REQUESTS } from '~/clusters_list/constants'; import * as actions from '~/clusters_list/store/actions'; import * as types from '~/clusters_list/store/mutation_types'; -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 Poll from '~/lib/utils/poll'; import { apiData } from '../mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('Clusters store actions', () => { let captureException; @@ -81,7 +81,7 @@ describe('Clusters store actions', () => { ); }); - it('should show flash on API error', async () => { + it('should show alert on API error', async () => { mock.onGet().reply(HTTP_STATUS_BAD_REQUEST, 'Not Found'); await testAction( diff --git a/spec/frontend/deploy_tokens/components/new_deploy_token_spec.js b/spec/frontend/deploy_tokens/components/new_deploy_token_spec.js index 46f7b2f36046b80e660888ccb45600b3dd6e8fdf..efd724116ab3ff06cdc6d7f132eb4457ed5235c5 100644 --- a/spec/frontend/deploy_tokens/components/new_deploy_token_spec.js +++ b/spec/frontend/deploy_tokens/components/new_deploy_token_spec.js @@ -7,20 +7,12 @@ import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/h import { TEST_HOST } from 'helpers/test_constants'; import NewDeployToken from '~/deploy_tokens/components/new_deploy_token.vue'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert, VARIANT_INFO } from '~/flash'; +import { createAlert, VARIANT_INFO } from '~/alert'; const createNewTokenPath = `${TEST_HOST}/create`; const deployTokensHelpUrl = `${TEST_HOST}/help`; -jest.mock('~/flash', () => { - const original = jest.requireActual('~/flash'); - - return { - __esModule: true, - ...original, - createAlert: jest.fn(), - }; -}); +jest.mock('~/alert'); describe('New Deploy Token', () => { let wrapper; @@ -91,7 +83,7 @@ describe('New Deploy Token', () => { }); } - it('should flash error message if token creation fails', async () => { + it('should alert error message if token creation fails', async () => { const mockAxios = new MockAdapter(axios); const date = new Date(); diff --git a/spec/frontend/design_management/pages/design/index_spec.js b/spec/frontend/design_management/pages/design/index_spec.js index 72b143d378967b4ecb6fba6064465d9251c16816..cd92198839bba78804cac761c4f26d9434fa07aa 100644 --- a/spec/frontend/design_management/pages/design/index_spec.js +++ b/spec/frontend/design_management/pages/design/index_spec.js @@ -23,7 +23,7 @@ import { DESIGN_SNOWPLOW_EVENT_TYPES, DESIGN_SERVICE_PING_EVENT_TYPES, } from '~/design_management/utils/tracking'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import * as cacheUpdate from '~/design_management/utils/cache_update'; import mockAllVersions from '../../mock_data/all_versions'; import design from '../../mock_data/design'; @@ -32,7 +32,7 @@ import mockResponseWithDesigns from '../../mock_data/designs'; import mockResponseNoDesigns from '../../mock_data/no_designs'; import { mockCreateImageNoteDiffResponse } from '../../mock_data/apollo_mock'; -jest.mock('~/flash'); +jest.mock('~/alert'); jest.mock('~/api.js'); const focusInput = jest.fn(); diff --git a/spec/frontend/design_management/pages/index_spec.js b/spec/frontend/design_management/pages/index_spec.js index fbb4df5eb6c948daf063e1ff480481c9fcc32d64..ce6a641c86d75ef1912ffdf89c31ee999c706386 100644 --- a/spec/frontend/design_management/pages/index_spec.js +++ b/spec/frontend/design_management/pages/index_spec.js @@ -29,7 +29,7 @@ import { DESIGN_TRACKING_PAGE_NAME, DESIGN_SNOWPLOW_EVENT_TYPES, } from '~/design_management/utils/tracking'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import DesignDropzone from '~/vue_shared/components/upload_dropzone/upload_dropzone.vue'; import { designListQueryResponse, @@ -41,7 +41,7 @@ import { moveDesignMutationResponseWithErrors, } from '../mock_data/apollo_mock'; -jest.mock('~/flash'); +jest.mock('~/alert'); const mockPageEl = { classList: { remove: jest.fn(), @@ -800,7 +800,7 @@ describe('Design management index page', () => { expect(draggableAttributes().disabled).toBe(false); }); - it('displays flash if mutation had a recoverable error', async () => { + it('displays alert if mutation had a recoverable error', async () => { createComponentWithApollo({ moveHandler: jest.fn().mockResolvedValue(moveDesignMutationResponseWithErrors), }); diff --git a/spec/frontend/design_management/utils/cache_update_spec.js b/spec/frontend/design_management/utils/cache_update_spec.js index 1c8075fac0259168e28878a3df2589e009558d07..e89dfe9f8601970c51f0a05d0229c511eb114c5a 100644 --- a/spec/frontend/design_management/utils/cache_update_spec.js +++ b/spec/frontend/design_management/utils/cache_update_spec.js @@ -10,10 +10,10 @@ import { ADD_IMAGE_DIFF_NOTE_ERROR, UPDATE_IMAGE_DIFF_NOTE_ERROR, } from '~/design_management/utils/error_messages'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import design from '../mock_data/design'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('Design Management cache update', () => { const mockErrors = ['code red!']; diff --git a/spec/frontend/diffs/store/actions_spec.js b/spec/frontend/diffs/store/actions_spec.js index b44b75382ad942a7efcb844d396565d8d0e730ec..f5036226b1e5f7e89b4835199826de71ce3500dc 100644 --- a/spec/frontend/diffs/store/actions_spec.js +++ b/spec/frontend/diffs/store/actions_spec.js @@ -13,7 +13,7 @@ import * as diffActions from '~/diffs/store/actions'; import * as types from '~/diffs/store/mutation_types'; import * as utils from '~/diffs/store/utils'; import * as treeWorkerUtils from '~/diffs/utils/tree_worker_utils'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import axios from '~/lib/utils/axios_utils'; import * as commonUtils from '~/lib/utils/common_utils'; import { @@ -26,7 +26,7 @@ import { mergeUrlParams } from '~/lib/utils/url_utility'; import eventHub from '~/notes/event_hub'; import { diffMetadata } from '../mock_data/diff_metadata'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('DiffsStoreActions', () => { let mock; @@ -273,7 +273,7 @@ describe('DiffsStoreActions', () => { ); }); - it('should show flash on API error', async () => { + it('should show alert on API error', async () => { mock.onGet(endpointCoverage).reply(HTTP_STATUS_BAD_REQUEST); await testAction(diffActions.fetchCoverageFiles, {}, { endpointCoverage }, [], []); diff --git a/spec/frontend/drawio/drawio_editor_spec.js b/spec/frontend/drawio/drawio_editor_spec.js index de93d0423966c1322e80778744096e68da33dc0d..bcf0179e2e2babcbd4e1a163af7503084f6ef82e 100644 --- a/spec/frontend/drawio/drawio_editor_spec.js +++ b/spec/frontend/drawio/drawio_editor_spec.js @@ -5,9 +5,9 @@ import { DIAGRAM_BACKGROUND_COLOR, DRAWIO_IFRAME_TIMEOUT, } from '~/drawio/constants'; -import { createAlert, VARIANT_SUCCESS } from '~/flash'; +import { createAlert, VARIANT_SUCCESS } from '~/alert'; -jest.mock('~/flash'); +jest.mock('~/alert'); jest.useFakeTimers(); diff --git a/spec/frontend/grafana_integration/components/grafana_integration_spec.js b/spec/frontend/grafana_integration/components/grafana_integration_spec.js index 021a3aa41edd266e9d0aef9c17a4701ffaa4a977..9cb27670c9844fe22aee8fe750cc83d290a97ad3 100644 --- a/spec/frontend/grafana_integration/components/grafana_integration_spec.js +++ b/spec/frontend/grafana_integration/components/grafana_integration_spec.js @@ -3,14 +3,14 @@ import { shallowMount } from '@vue/test-utils'; import { nextTick } from 'vue'; import { TEST_HOST } from 'helpers/test_constants'; import { mountExtended } from 'helpers/vue_test_utils_helper'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import GrafanaIntegration from '~/grafana_integration/components/grafana_integration.vue'; import { createStore } from '~/grafana_integration/store'; import axios from '~/lib/utils/axios_utils'; import { refreshCurrentPage } from '~/lib/utils/url_utility'; jest.mock('~/lib/utils/url_utility'); -jest.mock('~/flash'); +jest.mock('~/alert'); describe('grafana integration component', () => { let wrapper; @@ -103,7 +103,7 @@ describe('grafana integration component', () => { expect(refreshCurrentPage).toHaveBeenCalled(); }); - it('creates flash banner on error', async () => { + it('creates alert banner on error', async () => { const message = 'mockErrorMessage'; axios.patch.mockRejectedValue({ response: { data: { message } } }); diff --git a/spec/frontend/notes/components/comment_form_spec.js b/spec/frontend/notes/components/comment_form_spec.js index dfb05c85fc8ba927ffa38d083a756c5331797043..acee89ae096df5f1fbe4aa27904902a20275fa61 100644 --- a/spec/frontend/notes/components/comment_form_spec.js +++ b/spec/frontend/notes/components/comment_form_spec.js @@ -8,7 +8,7 @@ import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import Autosave from '~/autosave'; import batchComments from '~/batch_comments/stores/modules/batch_comments'; import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import axios from '~/lib/utils/axios_utils'; import { HTTP_STATUS_UNPROCESSABLE_ENTITY } from '~/lib/utils/http_status'; import CommentForm from '~/notes/components/comment_form.vue'; @@ -21,7 +21,7 @@ import { loggedOutnoteableData, notesDataMock, userDataMock, noteableDataMock } jest.mock('autosize'); jest.mock('~/commons/nav/user_merge_requests'); -jest.mock('~/flash'); +jest.mock('~/alert'); jest.mock('~/autosave'); Vue.use(Vuex); diff --git a/spec/frontend/notes/stores/actions_spec.js b/spec/frontend/notes/stores/actions_spec.js index f6cc0d12ee70b73ea78d353b3110733fec06b85e..9ac6744583760b98c54c3e30dd36d8824a665661 100644 --- a/spec/frontend/notes/stores/actions_spec.js +++ b/spec/frontend/notes/stores/actions_spec.js @@ -3,7 +3,7 @@ import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; import testAction from 'helpers/vuex_action_helper'; import { TEST_HOST } from 'spec/test_constants'; import Api from '~/api'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import toast from '~/vue_shared/plugins/global_toast'; import { EVENT_ISSUABLE_VUE_APP_CHANGE } from '~/issuable/constants'; import axios from '~/lib/utils/axios_utils'; @@ -36,7 +36,7 @@ import { const TEST_ERROR_MESSAGE = 'Test error message'; const mockAlertDismiss = jest.fn(); -jest.mock('~/flash', () => ({ +jest.mock('~/alert', () => ({ createAlert: jest.fn().mockImplementation(() => ({ dismiss: mockAlertDismiss, })), @@ -876,7 +876,7 @@ describe('Actions Notes Store', () => { const res = { errors: { base: ['something went wrong'] } }; const error = { message: 'Unprocessable entity', response: { data: res } }; - it('sets flash alert using errors.base message', async () => { + it('sets an alert using errors.base message', async () => { const resp = await actions.saveNote( { commit() {}, @@ -960,7 +960,7 @@ describe('Actions Notes Store', () => { }); }); - it('when service fails, flashes error message', () => { + it('when service fails, creates an alert with error message', () => { const response = { response: { data: { message: TEST_ERROR_MESSAGE } } }; Api.applySuggestion.mockReturnValue(Promise.reject(response)); diff --git a/spec/frontend/profile/account/components/update_username_spec.js b/spec/frontend/profile/account/components/update_username_spec.js index b19db73459dda5c1b05ea80b1cf5ec3ba276fd5e..6b325d70561b41036e693936e1ca2dffce138d0a 100644 --- a/spec/frontend/profile/account/components/update_username_spec.js +++ b/spec/frontend/profile/account/components/update_username_spec.js @@ -4,12 +4,12 @@ import Vue, { nextTick } from 'vue'; import waitForPromises from 'helpers/wait_for_promises'; import { TEST_HOST } from 'helpers/test_constants'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; -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 UpdateUsername from '~/profile/account/components/update_username.vue'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('UpdateUsername component', () => { const rootUrl = TEST_HOST; diff --git a/spec/frontend/profile/preferences/components/profile_preferences_spec.js b/spec/frontend/profile/preferences/components/profile_preferences_spec.js index 91cd868daacd3e7601d8ca0479d7e7c296633cb8..808e2cf41c9d075bceede69f18e50f36b5201764 100644 --- a/spec/frontend/profile/preferences/components/profile_preferences_spec.js +++ b/spec/frontend/profile/preferences/components/profile_preferences_spec.js @@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils'; import { nextTick } from 'vue'; import { useMockLocationHelper } from 'helpers/mock_window_location_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; -import { createAlert, VARIANT_DANGER, VARIANT_INFO } from '~/flash'; +import { createAlert, VARIANT_DANGER, VARIANT_INFO } from '~/alert'; import IntegrationView from '~/profile/preferences/components/integration_view.vue'; import ProfilePreferences from '~/profile/preferences/components/profile_preferences.vue'; import { i18n } from '~/profile/preferences/constants'; @@ -17,7 +17,7 @@ import { lightModeThemeId2, } from '../mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); const expectedUrl = '/foo'; useMockLocationHelper(); diff --git a/spec/frontend/token_access/inbound_token_access_spec.js b/spec/frontend/token_access/inbound_token_access_spec.js index fcd1a33fa680ed5adc32f4150366f4cfa6366c9d..1ca58053e6857b4f1d907e8f7b337363e33017ba 100644 --- a/spec/frontend/token_access/inbound_token_access_spec.js +++ b/spec/frontend/token_access/inbound_token_access_spec.js @@ -4,7 +4,7 @@ import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import { mountExtended, shallowMountExtended } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import InboundTokenAccess from '~/token_access/components/inbound_token_access.vue'; import inboundAddProjectCIJobTokenScopeMutation from '~/token_access/graphql/mutations/inbound_add_project_ci_job_token_scope.mutation.graphql'; import inboundRemoveProjectCIJobTokenScopeMutation from '~/token_access/graphql/mutations/inbound_remove_project_ci_job_token_scope.mutation.graphql'; @@ -26,7 +26,7 @@ const error = new Error(message); Vue.use(VueApollo); -jest.mock('~/flash'); +jest.mock('~/alert'); describe('TokenAccess component', () => { let wrapper; diff --git a/spec/frontend/token_access/opt_in_jwt_spec.js b/spec/frontend/token_access/opt_in_jwt_spec.js index 3a68f247aa6d2f6633e0084260d6f44eefb0a085..cdb385aa743f926a64366f2e59ceabfb5b9bbe23 100644 --- a/spec/frontend/token_access/opt_in_jwt_spec.js +++ b/spec/frontend/token_access/opt_in_jwt_spec.js @@ -4,7 +4,7 @@ import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import { mountExtended, shallowMountExtended } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import { OPT_IN_JWT_HELP_LINK } from '~/token_access/constants'; import OptInJwt from '~/token_access/components/opt_in_jwt.vue'; import getOptInJwtSettingQuery from '~/token_access/graphql/queries/get_opt_in_jwt_setting.query.graphql'; @@ -16,7 +16,7 @@ const error = new Error(errorMessage); Vue.use(VueApollo); -jest.mock('~/flash'); +jest.mock('~/alert'); describe('OptInJwt component', () => { let wrapper; diff --git a/spec/frontend/token_access/outbound_token_access_spec.js b/spec/frontend/token_access/outbound_token_access_spec.js index 893a021197fe635230d5ef24213080fd569fceeb..347ea1178bcebe670aab3c2d0c5316b248b258c0 100644 --- a/spec/frontend/token_access/outbound_token_access_spec.js +++ b/spec/frontend/token_access/outbound_token_access_spec.js @@ -4,7 +4,7 @@ import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import { mountExtended, shallowMountExtended } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import OutboundTokenAccess from '~/token_access/components/outbound_token_access.vue'; import addProjectCIJobTokenScopeMutation from '~/token_access/graphql/mutations/add_project_ci_job_token_scope.mutation.graphql'; import removeProjectCIJobTokenScopeMutation from '~/token_access/graphql/mutations/remove_project_ci_job_token_scope.mutation.graphql'; @@ -26,7 +26,7 @@ const error = new Error(message); Vue.use(VueApollo); -jest.mock('~/flash'); +jest.mock('~/alert'); describe('TokenAccess component', () => { let wrapper; diff --git a/spec/frontend/vue_merge_request_widget/deployment/deployment_actions_spec.js b/spec/frontend/vue_merge_request_widget/deployment/deployment_actions_spec.js index 41df485b0de4a15ca3adefa3d72f80fd7984ea3f..15c838a4a6f1eb70c47ffd631409daa8aa5b6f64 100644 --- a/spec/frontend/vue_merge_request_widget/deployment/deployment_actions_spec.js +++ b/spec/frontend/vue_merge_request_widget/deployment/deployment_actions_spec.js @@ -1,6 +1,6 @@ import { mount } from '@vue/test-utils'; import waitForPromises from 'helpers/wait_for_promises'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'; import { visitUrl } from '~/lib/utils/url_utility'; import { @@ -21,7 +21,7 @@ import { retryDetails, } from './deployment_mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); jest.mock('~/lib/utils/url_utility'); jest.mock('~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'); 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 0470249d7ce310cc345af56c3da4822c4c31c3d6..26446dc54511de8fa8079593ac5a959d312a0f59 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 @@ -7,7 +7,7 @@ import waitForPromises from 'helpers/wait_for_promises'; import WorkItemLinkChildMetadata from 'ee_else_ce/work_items/components/work_item_links/work_item_link_child_metadata.vue'; -import { createAlert } from '~/flash'; +import { createAlert } from '~/alert'; import RichTimestampTooltip from '~/vue_shared/components/rich_timestamp_tooltip.vue'; import getWorkItemTreeQuery from '~/work_items/graphql/work_item_tree.query.graphql'; @@ -31,7 +31,7 @@ import { workItemObjectiveMetadataWidgets, } from '../../mock_data'; -jest.mock('~/flash'); +jest.mock('~/alert'); describe('WorkItemLinkChild', () => { const WORK_ITEM_ID = 'gid://gitlab/WorkItem/2';