fix(webhook tests): more reliable date test

This commit is contained in:
Matteo Pagliazzi 2020-03-23 17:17:27 +01:00
parent f6484c872a
commit 9dcce382a3

View file

@ -414,8 +414,8 @@ describe('webhooks', () => {
user = await User.findById(user._id).exec();
expect(user.webhooks[0].failures).to.equal(1);
expect(user.webhooks[0].lastFailureAt.toLocaleString())
.to.equal((new Date()).toLocaleString());
// Check that the stored date is whitin 10s from now
expect((Date.now() - user.webhooks[0].lastFailureAt.getTime()) < 10000).to.be.true;
});
});
});