From 340de3feda5aac029d27eb4af4a219ad677a0faf Mon Sep 17 00:00:00 2001 From: Gene Hazan Date: Mon, 17 Apr 2017 11:25:24 -0700 Subject: [PATCH] Update test --- test/unit/crawlerTests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/crawlerTests.js b/test/unit/crawlerTests.js index 7734d1a..739e80c 100644 --- a/test/unit/crawlerTests.js +++ b/test/unit/crawlerTests.js @@ -103,11 +103,11 @@ describe('Crawler get request', () => { const queues = createBaseQueues({ priority: priority, normal: normal }); const crawler = createBaseCrawler({ queues: queues }); const requestBox = []; - const timeBeforeGetRequest = Date.now(); + sinon.stub(Q, 'delay', (request) => { return Q(request); }); return crawler._getRequest(requestBox, { name: 'test' }).then(request => { expect(request.type).to.be.equal('normal'); expect(request.attemptCount).to.be.equal(1); - expect(Date.now() - timeBeforeGetRequest).to.be.approximately(500, 20); + expect(Q.delay.callCount).to.be.equal(1); }); }); });