-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #229 from ckeditor/i/227
Tests: Added the memory leak tests. Closes #227. Tests: Added additional tests to cover all use-cases. Closes #183. Tests: Added tests for dev-utils. Tests: Grouped tests by test scenarios.
- Loading branch information
Showing
15 changed files
with
633 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
import Context from '../_utils/context'; | ||
|
||
describe( 'Context', () => { | ||
describe( 'constructor()', () => { | ||
it( 'saves the config', () => { | ||
const config = { foo: 'bar' }; | ||
const context = new Context( config ); | ||
|
||
expect( context.config ).to.equal( config ); | ||
} ); | ||
} ); | ||
|
||
describe( 'destroy()', () => { | ||
it( 'should return a promise that resolves properly', () => { | ||
return Context.create() | ||
.then( context => { | ||
const promise = context.destroy(); | ||
|
||
expect( promise ).to.be.an.instanceof( Promise ); | ||
|
||
return promise; | ||
} ); | ||
} ); | ||
} ); | ||
|
||
describe( 'create()', () => { | ||
it( 'should return a promise that resolves properly', () => { | ||
const promise = Context.create(); | ||
|
||
expect( promise ).to.be.an.instanceof( Promise ); | ||
|
||
return promise; | ||
} ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
/** | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/* global window */ | ||
|
||
/** | ||
* Turns off the default error catching | ||
* so Mocha won't complain about errors caused by the called function. | ||
*/ | ||
export default async function turnOffDefaultErrorCatching( fn ) { | ||
const originalOnError = window.onerror; | ||
window.onerror = null; | ||
import turnOffDefaultErrorCatching from '../_utils/turnoffdefaulterrorcatching'; | ||
|
||
describe( 'turnOffDefaultErrorCatching()', () => { | ||
it( 'should catch the error', () => { | ||
const onErrorStub = sinon.stub( window, 'onerror' ); | ||
|
||
turnOffDefaultErrorCatching( () => { | ||
window.onerror( 'Foo', null, 0 ); | ||
} ); | ||
|
||
await fn(); | ||
onErrorStub.restore(); | ||
|
||
window.onerror = originalOnError; | ||
} | ||
expect( onErrorStub.called ).to.equal( false ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/* global window */ | ||
|
||
/** | ||
* Turns off the default error catching | ||
* so Mocha won't complain about errors caused by the called function. | ||
*/ | ||
export default async function turnOffDefaultErrorCatching( fn ) { | ||
const originalOnError = window.onerror; | ||
window.onerror = () => {}; | ||
|
||
await fn(); | ||
|
||
window.onerror = originalOnError; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.