send(message) {
this.test.send(name, message, err => {
if (err) {
this.logger.info('error', err);
return;
}
this._logger.info('successfully sent');
});
}
我的测试:
testClass.send({value:'嘿'});
expect(sendSpy.mock.calls[0][0]).toEqual(name); // this works
expect(sendSpy.mock.calls[0][1]).toEqual(message); // this works
expect(sendSpy.mock.calls[0][2]).toBe(expect.anything) // this doesnt.
如何断言错误回调,以便覆盖所有行?