Skip to content

Commit d5092c6

Browse files
committed
Test if Promise is rejected on loading error.
1 parent ef96f78 commit d5092c6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,14 @@
261261
})
262262

263263
it('Handle image loading error', function () {
264-
return loadImage('404').catch(function (err) {
265-
expect(err).to.be.an.instanceOf(window.Event)
266-
expect(err.type).to.equal('error')
267-
})
264+
return loadImage('404')
265+
.then(function () {
266+
throw new Error('Promise not rejected')
267+
})
268+
.catch(function (err) {
269+
expect(err).to.be.an.instanceOf(window.Event)
270+
expect(err.type).to.equal('error')
271+
})
268272
})
269273

270274
it('Provide original image width+height in callback data', function () {

0 commit comments

Comments
 (0)