|
@@ -3,7 +3,7 @@
|
|
|
* For licensing, see LICENSE.md.
|
|
* For licensing, see LICENSE.md.
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
-import CKEditorError from '../src/ckeditorerror';
|
|
|
|
|
|
|
+import { default as CKEditorError, DOCUMENTATION_URL } from '../src/ckeditorerror';
|
|
|
|
|
|
|
|
describe( 'CKEditorError', () => {
|
|
describe( 'CKEditorError', () => {
|
|
|
it( 'inherits from Error', () => {
|
|
it( 'inherits from Error', () => {
|
|
@@ -52,6 +52,25 @@ describe( 'CKEditorError', () => {
|
|
|
expect( error ).to.have.property( 'data', data );
|
|
expect( error ).to.have.property( 'data', data );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
|
|
+ it( 'contains a link which leads to the documentation', () => {
|
|
|
|
|
+ const error = new CKEditorError( 'model-schema-no-item: Specified item cannot be found.' );
|
|
|
|
|
+
|
|
|
|
|
+ const errorMessage = 'model-schema-no-item: Specified item cannot be found. ' +
|
|
|
|
|
+ `Read more: ${ DOCUMENTATION_URL }#model-schema-no-item.\n`;
|
|
|
|
|
+
|
|
|
|
|
+ expect( error ).to.have.property( 'message', errorMessage );
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'link to documentation is added before the additional data message', () => {
|
|
|
|
|
+ const error = new CKEditorError( 'model-schema-no-item: Specified item cannot be found.', { foo: 1, bar: 2 } );
|
|
|
|
|
+
|
|
|
|
|
+ const errorMessage = 'model-schema-no-item: Specified item cannot be found. ' +
|
|
|
|
|
+ `Read more: ${ DOCUMENTATION_URL }#model-schema-no-item.\n ` +
|
|
|
|
|
+ '{"foo":1,"bar":2}';
|
|
|
|
|
+
|
|
|
|
|
+ expect( error ).to.have.property( 'message', errorMessage );
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
describe( 'isCKEditorError', () => {
|
|
describe( 'isCKEditorError', () => {
|
|
|
it( 'checks if error is an instance of CKEditorError', () => {
|
|
it( 'checks if error is an instance of CKEditorError', () => {
|
|
|
const ckeditorError = new CKEditorError( 'foo' );
|
|
const ckeditorError = new CKEditorError( 'foo' );
|