Skip to content

Commit

Permalink
make tests less flakey. related to #1322
Browse files Browse the repository at this point in the history
  • Loading branch information
aearly committed Apr 16, 2017
1 parent ed5de22 commit 81d66dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions mocha_test/applyEach.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'");
Expand Down
6 changes: 3 additions & 3 deletions mocha_test/retry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 81d66dd

Please sign in to comment.