我对日期断言有疑问。我希望有人可以帮助我,这是代码:
it('Put to api/rents edits a existing rent', done => {
const rent = new Rent({ startRentDate: '2017-05-18T16:00:00Z' });
rent.save().then(() => {
request(app)
.put('/api/rents/' + rent._id)
.send({startRentDate: '2016-05-18T16:00:00Z'})
.end(() => {
Rent.findOne({ _id: rent._id})
.then(rent => {
assert(rent.startRentDate === "2016-05-18T16:00:00Z" );
done();
});
});
});
});
我得到的错误是:
错误:超时超过2000毫秒。对于异步测试和挂钩,请确保调用了“ done()”;如果返回承诺,请确保其解决。 (C:\ Users \ JAAMH \ Desktop \ Tool Verhuur Service \ VerhuurBackend \ VerhuurBackend \ test \ controllers \ rent.controller.test.js)