Add failing spec for rejected remote promise

This commit is contained in:
Kevin Sawicki 2016-05-23 15:06:46 -07:00
parent 1c9fe8d23e
commit f3af1dbd54
2 changed files with 21 additions and 0 deletions

View file

@ -106,6 +106,22 @@ describe('ipc module', function () {
done()
})
})
it('handles rejections via catch(onRejected)', function (done) {
var promise = remote.require(path.join(fixtures, 'module', 'rejected-promise.js'))
promise.reject(Promise.resolve(1234)).catch(function (error) {
assert.equal(error.message, 'rejected')
done()
})
})
it('handles rejections via then(onFulfilled, onRejected)', function (done) {
var promise = remote.require(path.join(fixtures, 'module', 'rejected-promise.js'))
promise.reject(Promise.resolve(1234)).then(function () {}, function (error) {
assert.equal(error.message, 'rejected')
done()
})
})
})
describe('remote webContents', function () {

View file

@ -0,0 +1,5 @@
exports.reject = function (promise) {
return promise.then(function () {
throw Error('rejected')
})
}