1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Improve test

This commit is contained in:
Ruben Bridgewater
2016-03-26 00:42:33 +01:00
parent a8e7d59e62
commit 7af90043c8

View File

@@ -52,8 +52,10 @@ describe("client authentication", function () {
var time = Date.now();
client.auth(auth, function (err, res) {
assert.strictEqual('retry worked', res);
assert(Date.now() - time >= 200, 'Time should be above 200 ms (the reconnect time)');
assert(Date.now() - time < 300, 'Time should be below 300 ms (the reconnect should only take a bit above 200 ms)');
var now = Date.now();
// Hint: setTimeout sometimes triggers early and therefor the value can be like one or two ms to early
assert(now - time >= 198, 'Time should be above 200 ms (the reconnect time) and is ' + (now - time));
assert(now - time < 300, 'Time should be below 300 ms (the reconnect should only take a bit above 200 ms) and is ' + (now - time));
done();
});
var tmp = client.command_queue.get(0).callback;