Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-16 00:07:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-16 00:07:28 +0300
commitd22c6f7410966b5288a8b8e904cd24758e9cec50 (patch)
treeb54768ea1b03a1affb798898e2cf81fd1259e80b /spec/frontend/blob_edit
parenta84aefe0bb8fc2ad47ab67cb4ddcfbb7aecfbd5e (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.js24
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 });
+ });
+ });
});