考虑我有这个代码分支:
if (somethingGood) {
// do something
} else {
const error = new Error('Some specific message');
next(error);
}
如何断言使用该错误消息调用next(下一个是使用sinon.stub()
存根)?
我最初尝试过:
expect(next.calledWith('Some specific message')).to.eql(true);
但是,当然这不起作用,因为接下来实际上是在调用错误。