fix tests from #1470

This commit is contained in:
Leo Horie 2016-12-07 11:58:30 -05:00
parent dbb3469985
commit 0b84a3f39f
3 changed files with 31 additions and 23 deletions

View file

@ -405,20 +405,23 @@ o.spec("promise", function() {
})
o("triggers all branched rejection handlers upon rejection", function(done) {
var promise = Promise.reject()
var then = o.spy()
var catch1 = o.spy()
var catch2 = o.spy()
var catch3 = o.spy()
var then = o.spy()
var catch1 = o.spy()
var catch2 = o.spy()
var catch3 = o.spy()
promise.catch(catch1)
promise.then(then, catch2).catch(catch3)
promise.then(then, catch2)
promise.then(then).catch(catch3)
promise.then(null, function(){
o(catch1.callCount).equals(1, "first branch catch triggers")
o(then.callCount).equals(0, "second branch then resolution handler doesn't trigger")
o(catch2.callCount).equals(1, "second branch then rejection handler triggers")
o(catch3.callCount).equals(1, "second branch subseqent catch triggers")
done()
callAsync(function() {
callAsync(function() {
o(catch1.callCount).equals(1)
o(then.callCount).equals(0)
o(catch2.callCount).equals(1)
o(catch3.callCount).equals(1)
done()
})
})
})
o("does not absorb resolved promise via static rejector", function(done) {