fix(webhook tests): do not rely on toLocaleString when checking for two dates to be close

This commit is contained in:
Matteo Pagliazzi
2020-03-24 12:28:15 +01:00
parent 25e72ad907
commit 3458d89c1d

View File

@@ -376,8 +376,7 @@ describe('webhooks', () => {
user = await User.findById(user._id).exec(); user = await User.findById(user._id).exec();
expect(user.webhooks[0].failures).to.equal(1); expect(user.webhooks[0].failures).to.equal(1);
expect(user.webhooks[0].lastFailureAt.toLocaleString()) expect((Date.now() - user.webhooks[0].lastFailureAt.getTime()) < 10000).to.be.true;
.to.equal((new Date()).toLocaleString());
}); });
it('disables a webhook after 10 failures', async () => { it('disables a webhook after 10 failures', async () => {