diff options
Diffstat (limited to 'spec/frontend/feature_highlight/feature_highlight_helper_spec.js')
-rw-r--r-- | spec/frontend/feature_highlight/feature_highlight_helper_spec.js | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/spec/frontend/feature_highlight/feature_highlight_helper_spec.js b/spec/frontend/feature_highlight/feature_highlight_helper_spec.js deleted file mode 100644 index 4609bfc23d7..00000000000 --- a/spec/frontend/feature_highlight/feature_highlight_helper_spec.js +++ /dev/null @@ -1,42 +0,0 @@ -import MockAdapter from 'axios-mock-adapter'; -import { dismiss } from '~/feature_highlight/feature_highlight_helper'; -import { createAlert } from '~/alert'; -import axios from '~/lib/utils/axios_utils'; -import { HTTP_STATUS_CREATED, HTTP_STATUS_INTERNAL_SERVER_ERROR } from '~/lib/utils/http_status'; - -jest.mock('~/alert'); - -describe('feature highlight helper', () => { - describe('dismiss', () => { - let mockAxios; - const endpoint = '/-/callouts/dismiss'; - const highlightId = '123'; - - beforeEach(() => { - mockAxios = new MockAdapter(axios); - }); - - afterEach(() => { - mockAxios.reset(); - }); - - it('calls persistent dismissal endpoint with highlightId', async () => { - mockAxios.onPost(endpoint, { feature_name: highlightId }).replyOnce(HTTP_STATUS_CREATED); - - await expect(dismiss(endpoint, highlightId)).resolves.toEqual(expect.anything()); - }); - - it('triggers an alert when dismiss request fails', async () => { - mockAxios - .onPost(endpoint, { feature_name: highlightId }) - .replyOnce(HTTP_STATUS_INTERNAL_SERVER_ERROR); - - await dismiss(endpoint, highlightId); - - expect(createAlert).toHaveBeenCalledWith({ - message: - 'An error occurred while dismissing the feature highlight. Refresh the page and try dismissing again.', - }); - }); - }); -}); |