You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
tests: fix socket timeout test Node <= 4
This commit is contained in:
@@ -401,10 +401,22 @@ describe('connection tests', function () {
|
||||
connect_timeout: 1000
|
||||
});
|
||||
process.nextTick(function () {
|
||||
assert.strictEqual(client.stream.timeout, 1000);
|
||||
// node > 4
|
||||
var timeout = client.stream.timeout;
|
||||
// node <= 4
|
||||
if (timeout === undefined) timeout = client.stream._idleTimeout;
|
||||
assert.strictEqual(timeout, 1000);
|
||||
});
|
||||
client.on('connect', function () {
|
||||
assert.strictEqual(client.stream.timeout, 0);
|
||||
// node > 4
|
||||
var expected = 0;
|
||||
var timeout = client.stream.timeout;
|
||||
// node <= 4
|
||||
if (timeout === undefined) {
|
||||
timeout = client.stream._idleTimeout;
|
||||
expected = -1;
|
||||
}
|
||||
assert.strictEqual(timeout, expected);
|
||||
assert.strictEqual(client.stream.listeners('timeout').length, 0);
|
||||
client.on('ready', done);
|
||||
});
|
||||
|
Reference in New Issue
Block a user