From 3458d89c1de85068c23c755beaa5d07f1ab6475b Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Tue, 24 Mar 2020 12:28:15 +0100 Subject: [PATCH] fix(webhook tests): do not rely on toLocaleString when checking for two dates to be close --- test/api/unit/libs/webhooks.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/api/unit/libs/webhooks.test.js b/test/api/unit/libs/webhooks.test.js index 59b25785ad..1715e99650 100644 --- a/test/api/unit/libs/webhooks.test.js +++ b/test/api/unit/libs/webhooks.test.js @@ -376,8 +376,7 @@ 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()); + expect((Date.now() - user.webhooks[0].lastFailureAt.getTime()) < 10000).to.be.true; }); it('disables a webhook after 10 failures', async () => {