|
@@ -25,6 +25,7 @@ import { getData as getViewData, stringify as stringifyView } from '@ckeditor/ck
|
|
|
|
|
|
|
|
import env from '@ckeditor/ckeditor5-utils/src/env';
|
|
import env from '@ckeditor/ckeditor5-utils/src/env';
|
|
|
import Notification from '@ckeditor/ckeditor5-ui/src/notification/notification';
|
|
import Notification from '@ckeditor/ckeditor5-ui/src/notification/notification';
|
|
|
|
|
+import { assertCKEditorError } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
|
|
|
|
|
|
|
|
describe( 'ImageUploadEditing', () => {
|
|
describe( 'ImageUploadEditing', () => {
|
|
|
// eslint-disable-next-line max-len
|
|
// eslint-disable-next-line max-len
|
|
@@ -450,6 +451,7 @@ describe( 'ImageUploadEditing', () => {
|
|
|
it( 'should throw when other error happens during upload', done => {
|
|
it( 'should throw when other error happens during upload', done => {
|
|
|
const file = createNativeFileMock();
|
|
const file = createNativeFileMock();
|
|
|
const error = new Error( 'Foo bar baz' );
|
|
const error = new Error( 'Foo bar baz' );
|
|
|
|
|
+ error.stack = 'biz';
|
|
|
const uploadEditing = editor.plugins.get( ImageUploadEditing );
|
|
const uploadEditing = editor.plugins.get( ImageUploadEditing );
|
|
|
const loadSpy = sinon.spy( uploadEditing, '_readAndUpload' );
|
|
const loadSpy = sinon.spy( uploadEditing, '_readAndUpload' );
|
|
|
const catchSpy = sinon.spy();
|
|
const catchSpy = sinon.spy();
|
|
@@ -476,7 +478,16 @@ describe( 'ImageUploadEditing', () => {
|
|
|
|
|
|
|
|
setTimeout( () => {
|
|
setTimeout( () => {
|
|
|
sinon.assert.calledOnce( catchSpy );
|
|
sinon.assert.calledOnce( catchSpy );
|
|
|
- sinon.assert.calledWithExactly( catchSpy, error );
|
|
|
|
|
|
|
+ const error = catchSpy.getCall( 0 ).args[ 0 ];
|
|
|
|
|
+
|
|
|
|
|
+ assertCKEditorError( error, /unexpected-error/, editor, {
|
|
|
|
|
+ originalError: {
|
|
|
|
|
+ name: 'Error',
|
|
|
|
|
+ message: 'Foo bar baz',
|
|
|
|
|
+ stack: 'biz'
|
|
|
|
|
+ }
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
done();
|
|
done();
|
|
|
}, 0 );
|
|
}, 0 );
|
|
|
} );
|
|
} );
|