From 9dcce382a31960c974ad16ac11a9a6fc407325a1 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Mon, 23 Mar 2020 17:17:27 +0100 Subject: [PATCH] fix(webhook tests): more reliable date test --- test/api/unit/libs/webhooks.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/api/unit/libs/webhooks.test.js b/test/api/unit/libs/webhooks.test.js index c8f745499f..59b25785ad 100644 --- a/test/api/unit/libs/webhooks.test.js +++ b/test/api/unit/libs/webhooks.test.js @@ -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; }); }); });