You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
Improve test
This commit is contained in:
@@ -52,8 +52,10 @@ describe("client authentication", function () {
|
|||||||
var time = Date.now();
|
var time = Date.now();
|
||||||
client.auth(auth, function (err, res) {
|
client.auth(auth, function (err, res) {
|
||||||
assert.strictEqual('retry worked', res);
|
assert.strictEqual('retry worked', res);
|
||||||
assert(Date.now() - time >= 200, 'Time should be above 200 ms (the reconnect time)');
|
var now = Date.now();
|
||||||
assert(Date.now() - time < 300, 'Time should be below 300 ms (the reconnect should only take a bit above 200 ms)');
|
// 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();
|
done();
|
||||||
});
|
});
|
||||||
var tmp = client.command_queue.get(0).callback;
|
var tmp = client.command_queue.get(0).callback;
|
||||||
|
Reference in New Issue
Block a user