diff options
Diffstat (limited to 'spec/frontend/alerts_settings/components/alerts_settings_wrapper_spec.js')
-rw-r--r-- | spec/frontend/alerts_settings/components/alerts_settings_wrapper_spec.js | 26 |
1 files changed, 13 insertions, 13 deletions
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 0266adeb6c7..fcefcb7cf66 100644 --- a/spec/frontend/alerts_settings/components/alerts_settings_wrapper_spec.js +++ b/spec/frontend/alerts_settings/components/alerts_settings_wrapper_spec.js @@ -30,7 +30,7 @@ import { INTEGRATION_INACTIVE_PAYLOAD_TEST_ERROR, DELETE_INTEGRATION_ERROR, } from '~/alerts_settings/utils/error_messages'; -import createFlash, { FLASH_TYPES } from '~/flash'; +import { createAlert, VARIANT_SUCCESS } from '~/flash'; import axios from '~/lib/utils/axios_utils'; import httpStatusCodes from '~/lib/utils/http_status'; import { @@ -327,7 +327,7 @@ describe('AlertsSettingsWrapper', () => { await waitForPromises(); - expect(createFlash).toHaveBeenCalledWith({ message: ADD_INTEGRATION_ERROR }); + expect(createAlert).toHaveBeenCalledWith({ message: ADD_INTEGRATION_ERROR }); }); it('shows an error alert when integration token reset fails', async () => { @@ -336,7 +336,7 @@ describe('AlertsSettingsWrapper', () => { findAlertsSettingsForm().vm.$emit('reset-token', {}); await waitForPromises(); - expect(createFlash).toHaveBeenCalledWith({ message: RESET_INTEGRATION_TOKEN_ERROR }); + expect(createAlert).toHaveBeenCalledWith({ message: RESET_INTEGRATION_TOKEN_ERROR }); }); it('shows an error alert when integration update fails', async () => { @@ -345,7 +345,7 @@ describe('AlertsSettingsWrapper', () => { findAlertsSettingsForm().vm.$emit('update-integration', {}); await waitForPromises(); - expect(createFlash).toHaveBeenCalledWith({ message: UPDATE_INTEGRATION_ERROR }); + expect(createAlert).toHaveBeenCalledWith({ message: UPDATE_INTEGRATION_ERROR }); }); describe('Test alert failure', () => { @@ -360,17 +360,17 @@ describe('AlertsSettingsWrapper', () => { it('shows an error alert when integration test payload is invalid', async () => { mock.onPost(/(.*)/).replyOnce(httpStatusCodes.UNPROCESSABLE_ENTITY); await wrapper.vm.testAlertPayload({ endpoint: '', data: '', token: '' }); - expect(createFlash).toHaveBeenCalledWith({ message: INTEGRATION_PAYLOAD_TEST_ERROR }); - expect(createFlash).toHaveBeenCalledTimes(1); + expect(createAlert).toHaveBeenCalledWith({ message: INTEGRATION_PAYLOAD_TEST_ERROR }); + expect(createAlert).toHaveBeenCalledTimes(1); }); it('shows an error alert when integration is not activated', async () => { mock.onPost(/(.*)/).replyOnce(httpStatusCodes.FORBIDDEN); await wrapper.vm.testAlertPayload({ endpoint: '', data: '', token: '' }); - expect(createFlash).toHaveBeenCalledWith({ + expect(createAlert).toHaveBeenCalledWith({ message: INTEGRATION_INACTIVE_PAYLOAD_TEST_ERROR, }); - expect(createFlash).toHaveBeenCalledTimes(1); + expect(createAlert).toHaveBeenCalledTimes(1); }); }); @@ -444,9 +444,9 @@ describe('AlertsSettingsWrapper', () => { jest.spyOn(alertsUpdateService, 'updateTestAlert').mockResolvedValueOnce({}); findAlertsSettingsForm().vm.$emit('test-alert-payload', ''); await waitForPromises(); - expect(createFlash).toHaveBeenCalledWith({ + expect(createAlert).toHaveBeenCalledWith({ message: i18n.alertSent, - type: FLASH_TYPES.SUCCESS, + variant: VARIANT_SUCCESS, }); }); @@ -454,7 +454,7 @@ describe('AlertsSettingsWrapper', () => { jest.spyOn(alertsUpdateService, 'updateTestAlert').mockRejectedValueOnce({}); findAlertsSettingsForm().vm.$emit('test-alert-payload', ''); await waitForPromises(); - expect(createFlash).toHaveBeenCalledWith({ + expect(createAlert).toHaveBeenCalledWith({ message: INTEGRATION_PAYLOAD_TEST_ERROR, }); }); @@ -486,7 +486,7 @@ describe('AlertsSettingsWrapper', () => { await destroyHttpIntegration(wrapper); await waitForPromises(); - expect(createFlash).toHaveBeenCalledWith({ message: 'Houston, we have a problem' }); + expect(createAlert).toHaveBeenCalledWith({ message: 'Houston, we have a problem' }); }); it('displays flash if mutation had a non-recoverable error', async () => { @@ -497,7 +497,7 @@ describe('AlertsSettingsWrapper', () => { await destroyHttpIntegration(wrapper); await waitForPromises(); - expect(createFlash).toHaveBeenCalledWith({ + expect(createAlert).toHaveBeenCalledWith({ message: DELETE_INTEGRATION_ERROR, }); }); |