File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import {expect} from 'chai'
99import sinon from 'sinon'
1010
1111import ScriptLoader from '../src'
12+ import loadScript from '../src/loadScript'
1213
1314describe ( 'ScriptLoader' , ( ) => {
1415 afterEach ( ( ) => {
@@ -215,3 +216,16 @@ describe('ScriptLoader', () => {
215216 expect ( oldOnError . called ) . to . be . false
216217 } )
217218} )
219+ describe ( `loadScript` , function ( ) {
220+ it ( `errors if document is not defined` , async function ( ) : Promise < void > {
221+ const prevDocument = document
222+ document = undefined // eslint-disable-line no-global-assign
223+ try {
224+ let error : ?Error
225+ await loadScript ( { src : 'documentundefined' } ) . catch ( err => error = err )
226+ expect ( error ) . to . exist
227+ } finally {
228+ document = prevDocument // eslint-disable-line no-global-assign
229+ }
230+ } )
231+ } )
You can’t perform that action at this time.
0 commit comments