8
0
Просмотр исходного кода

Added missing test for the ContextWatchdog.

Maciej Bukowski 6 лет назад
Родитель
Сommit
7d6a118060
1 измененных файлов с 10 добавлено и 5 удалено
  1. 10 5
      packages/ckeditor5-watchdog/tests/contextwatchdog.js

+ 10 - 5
packages/ckeditor5-watchdog/tests/contextwatchdog.js

@@ -132,14 +132,19 @@ describe( 'ContextWatchdog', () => {
 		} );
 
 		it( 'should handle the Watchdog configuration', async () => {
-			// TODO
-			const mainWatchdog = new ContextWatchdog( Context, {
-				crashNumberLimit: Infinity
+			watchdog = new ContextWatchdog( Context, {
+				crashNumberLimit: 0
 			} );
 
-			await mainWatchdog.create();
+			await watchdog.create();
 
-			await mainWatchdog.destroy();
+			setTimeout( () => throwCKEditorError( 'foo', watchdog.context ) );
+
+			await waitCycle();
+
+			expect( watchdog.state ).to.equal( 'crashedPermanently' );
+
+			await watchdog.destroy();
 		} );
 
 		describe( 'in case of error handling', () => {