Add failing spec for rejected remote promise
This commit is contained in:
parent
1c9fe8d23e
commit
f3af1dbd54
2 changed files with 21 additions and 0 deletions
|
@ -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 () {
|
||||
|
|
5
spec/fixtures/module/rejected-promise.js
vendored
Normal file
5
spec/fixtures/module/rejected-promise.js
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
exports.reject = function (promise) {
|
||||
return promise.then(function () {
|
||||
throw Error('rejected')
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue