Skip to content

Commit 1c16a95

Browse files
committed
test: increase coverage
1 parent 1ec6f9e commit 1c16a95

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {expect} from 'chai'
99
import sinon from 'sinon'
1010

1111
import ScriptLoader from '../src'
12+
import loadScript from '../src/loadScript'
1213

1314
describe('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+
})

0 commit comments

Comments
 (0)