我正在编写单元测试,我遇到了问题,我的问题是我无法处理http状态。这就是我所做的,
describe('Should return 400 bad request', () => {
before(() => {
const { get400, baseUrl } = BillingMock.getPaymentSummary;
const mockHttp = nock(baseUrl);
mockHttp.get(get400.req.path).reply(get400.res.httpStatus, get400.res);
});
it('Should return 400 bad request', async () => {
const { get400 } = BillingMock.getPaymentSummary;
const { req, res } = get400;
const callback = () => BillingApi.getPaymentSummary(req);
await callback().should.have.status(404);
});
});