8
0
Quellcode durchsuchen

Changed test assertion as it should throw now the `unexpected-error` error.

Maciej Bukowski vor 6 Jahren
Ursprung
Commit
9e311e4f5d
1 geänderte Dateien mit 12 neuen und 1 gelöschten Zeilen
  1. 12 1
      packages/ckeditor5-image/tests/imageupload/imageuploadediting.js

+ 12 - 1
packages/ckeditor5-image/tests/imageupload/imageuploadediting.js

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