diff options
author | Alexander Early <alexander.early@gmail.com> | 2017-04-16 12:14:45 -0700 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2017-04-16 12:14:45 -0700 |
commit | 81d66dd219f62bb24fc3ca684236bdddc4cc4267 (patch) | |
tree | db2b30c2858c71a390cd974ea7dc252688f56dc7 | |
parent | ed5de2217d52fc1c050b48c708b1197620ee0cec (diff) | |
download | async-81d66dd219f62bb24fc3ca684236bdddc4cc4267.tar.gz |
make tests less flakey. related to #1322
-rw-r--r-- | mocha_test/applyEach.js | 6 | ||||
-rw-r--r-- | mocha_test/retry.js | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/mocha_test/applyEach.js b/mocha_test/applyEach.js index 6138d3f..ca5ada3 100644 --- a/mocha_test/applyEach.js +++ b/mocha_test/applyEach.js @@ -11,21 +11,21 @@ describe('applyEach', function () { setTimeout(function () { call_order.push('one'); cb(null, 1); - }, 10); + }, 12); }; var two = function (val, cb) { expect(val).to.equal(5); setTimeout(function () { call_order.push('two'); cb(null, 2); - }, 5); + }, 2); }; var three = function (val, cb) { expect(val).to.equal(5); setTimeout(function () { call_order.push('three'); cb(null, 3); - }, 15); + }, 18); }; async.applyEach([one, two, three], 5, function (err, results) { assert(err === null, err + " passed instead of 'null'"); diff --git a/mocha_test/retry.js b/mocha_test/retry.js index 6185f3c..8a9f4da 100644 --- a/mocha_test/retry.js +++ b/mocha_test/retry.js @@ -69,7 +69,7 @@ describe("retry", function () { var start = Date.now(); async.retry({ times: times, interval: interval}, fn, function(err, result){ var duration = Date.now() - start; - expect(duration).to.be.above(interval * (times - 1) - 1); + expect(duration).to.be.above(interval * (times - 1) - times); assert.equal(callCount, 3, "did not retry the correct number of times"); assert.equal(err, error + times, "Incorrect error was returned"); assert.equal(result, erroredResult + times, "Incorrect result was returned"); @@ -90,7 +90,7 @@ describe("retry", function () { var start = Date.now(); async.retry({ times: times, interval: intervalFunc}, fn, function(err, result){ var duration = Date.now() - start; - expect(duration).to.be.above(299); + expect(duration).to.be.above(300 - times); assert.equal(callCount, 3, "did not retry the correct number of times"); assert.equal(err, error + times, "Incorrect error was returned"); assert.equal(result, erroredResult + times, "Incorrect result was returned"); @@ -227,7 +227,7 @@ describe("retry", function () { var start = Date.now(); async.retry({ interval: interval, errorFilter: errorTest }, fn, function(err, result){ var duration = Date.now() - start; - expect(duration).to.be.above(interval * (specialCount - 1) - 1); + expect(duration).to.be.above(interval * (specialCount - 1) - specialCount); assert.equal(callCount, specialCount, "did not retry the correct number of times"); assert.equal(err, special, "Incorrect error was returned"); assert.equal(result, erroredResult + specialCount, "Incorrect result was returned"); |