我必須做一些錯誤的解決,但是這是我的測試用例:青鳥承諾變成在任何情況下
const { describe, it } = require('mocha'),
should = require('should'),
Promise = require('bluebird') //v3.4.6
describe('Bluebird',() => {
it('Promise is never resolved but does it get resolved?',() => {
new Promise(() => false)
.should.be.fulfilled() // It really shouldn't be
})
})
這通過,但它不應該失敗?
爲什麼你有雙重斷言?處理「拒絕」的承諾是一個決心。 –
@ DanielA.White'.rejectedWith'將會*通過*,但我注意到這個承諾也被解析**,這就是這個測試用例所展現的。這裏沒有鏈接承諾 –
我會看看摩卡如何看待承諾的狀態。 –