|
|
@@ -6,6 +6,7 @@
|
|
|
/* globals console */
|
|
|
|
|
|
import log from '../src/log';
|
|
|
+import { DOCUMENTATION_URL } from '../src/ckeditorerror';
|
|
|
|
|
|
describe( 'log', () => {
|
|
|
let spy;
|
|
|
@@ -18,7 +19,7 @@ describe( 'log', () => {
|
|
|
|
|
|
describe( 'warn()', () => {
|
|
|
it( 'logs the message to the console using console.warn()', () => {
|
|
|
- const spy = sinon.stub( console, 'warn' );
|
|
|
+ spy = sinon.stub( console, 'warn' );
|
|
|
const data = { bar: 1 };
|
|
|
|
|
|
log.warn( 'foo', data );
|
|
|
@@ -30,11 +31,23 @@ describe( 'log', () => {
|
|
|
sinon.assert.calledTwice( spy );
|
|
|
sinon.assert.calledWith( spy, 'bar' );
|
|
|
} );
|
|
|
+
|
|
|
+ it( 'contains a link which leads to the documentation', () => {
|
|
|
+ spy = sinon.stub( console, 'warn' );
|
|
|
+
|
|
|
+ log.warn( 'model-schema-no-item: Specified item cannot be found.' );
|
|
|
+
|
|
|
+ const logMessage = 'model-schema-no-item: Specified item cannot be found. ' +
|
|
|
+ `Read more: ${ DOCUMENTATION_URL }#model-schema-no-item.\n`;
|
|
|
+
|
|
|
+ sinon.assert.calledOnce( spy );
|
|
|
+ sinon.assert.calledWith( spy, logMessage );
|
|
|
+ } );
|
|
|
} );
|
|
|
|
|
|
describe( 'error()', () => {
|
|
|
it( 'logs the message to the console using console.error()', () => {
|
|
|
- const spy = sinon.stub( console, 'error' );
|
|
|
+ spy = sinon.stub( console, 'error' );
|
|
|
const data = { bar: 1 };
|
|
|
|
|
|
log.error( 'foo', data );
|
|
|
@@ -46,5 +59,17 @@ describe( 'log', () => {
|
|
|
sinon.assert.calledTwice( spy );
|
|
|
sinon.assert.calledWith( spy, 'bar' );
|
|
|
} );
|
|
|
+
|
|
|
+ it( 'contains a link which leads to the documentation', () => {
|
|
|
+ spy = sinon.stub( console, 'error' );
|
|
|
+
|
|
|
+ log.error( 'model-schema-no-item: Specified item cannot be found.' );
|
|
|
+
|
|
|
+ const logMessage = 'model-schema-no-item: Specified item cannot be found. ' +
|
|
|
+ `Read more: ${ DOCUMENTATION_URL }#model-schema-no-item.\n`;
|
|
|
+
|
|
|
+ sinon.assert.calledOnce( spy );
|
|
|
+ sinon.assert.calledWith( spy, logMessage );
|
|
|
+ } );
|
|
|
} );
|
|
|
} );
|