diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-16 00:07:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-16 00:07:28 +0300 |
commit | d22c6f7410966b5288a8b8e904cd24758e9cec50 (patch) | |
tree | b54768ea1b03a1affb798898e2cf81fd1259e80b /spec/frontend/blob_edit | |
parent | a84aefe0bb8fc2ad47ab67cb4ddcfbb7aecfbd5e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/blob_edit')
-rw-r--r-- | spec/frontend/blob_edit/blob_bundle_spec.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/frontend/blob_edit/blob_bundle_spec.js b/spec/frontend/blob_edit/blob_bundle_spec.js index 644539308c2..ed42322b0e6 100644 --- a/spec/frontend/blob_edit/blob_bundle_spec.js +++ b/spec/frontend/blob_edit/blob_bundle_spec.js @@ -5,8 +5,10 @@ import waitForPromises from 'helpers/wait_for_promises'; import blobBundle from '~/blob_edit/blob_bundle'; import SourceEditor from '~/blob_edit/edit_blob'; +import { createAlert } from '~/flash'; jest.mock('~/blob_edit/edit_blob'); +jest.mock('~/flash'); describe('BlobBundle', () => { it('does not load SourceEditor by default', () => { @@ -93,4 +95,26 @@ describe('BlobBundle', () => { }); }); }); + + describe('Error handling', () => { + let message; + beforeEach(() => { + setHTMLFixture(`<div class="js-edit-blob-form" data-blob-filename="blah"></div>`); + message = 'Foo'; + SourceEditor.mockImplementation(() => { + throw new Error(message); + }); + }); + + afterEach(() => { + resetHTMLFixture(); + SourceEditor.mockClear(); + }); + + it('correctly outputs error message when it occurs', async () => { + blobBundle(); + await waitForPromises(); + expect(createAlert).toHaveBeenCalledWith({ message }); + }); + }); }); |