From 3470ec561fd28bc2786e72ea05ddd4f304ec62fd Mon Sep 17 00:00:00 2001 From: Alec Gibson <12036746+alecgibson@users.noreply.github.com> Date: Wed, 12 Jun 2024 10:29:51 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Fix=20a=20slightly=20flaky=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes this test fails with: ``` 1) mongo db connection via url string with mongoPoll and pollDelay option delays queryPoll but not commit: Uncaught AssertionError: expected 1000 to be above 1000 + expected - actual at /home/runner/work/sharedb-mongo/sharedb-mongo/test/test_mongo.js:541:48 at /home/runner/work/sharedb-mongo/sharedb-mongo/index.js:133:2086 at /home/runner/work/sharedb-mongo/sharedb-mongo/index.js:133:109 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ``` We don't care about the exact millisecond, so this change updates the assertion to `greaterThanOrEqual()` --- test/test_mongo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_mongo.js b/test/test_mongo.js index 1a3f94c..36ba42c 100644 --- a/test/test_mongo.js +++ b/test/test_mongo.js @@ -538,7 +538,7 @@ describe('mongo db connection', function() { db.queryPoll('testcollection', {}, null, function(err, results) { if (err) return done(err); expect(results.length).eql(1); - expect((new Date) - timeBeforeQuery).greaterThan(pollDelay); + expect((new Date) - timeBeforeQuery).greaterThanOrEqual(pollDelay); done(); }); });