Consider I have this branch of code:
if (somethingGood) {
// do something
} else {
const error = new Error('Some specific message');
next(error);
}
How can I assert that next is called with that error message (next is stubbed using sinon.stub()
)?
I initially tried:
expect(next.calledWith('Some specific message')).to.eql(true);
But, of course that does not work because next was actually called with an error.