Skip to content

Commit b867eef

Browse files
committed
Fix tests
1 parent 2bc1dbe commit b867eef

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/connection.spec.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ describe('connection tests', function () {
349349
});
350350
});
351351

352-
it('clears the socket timeout after a connection has been established', function (done) {
352+
it('clears connect_timeout on the socket timeout after a connection has been established', function (done) {
353353
client = redis.createClient({
354354
connect_timeout: 1000
355355
});
@@ -374,6 +374,23 @@ describe('connection tests', function () {
374374
client.on('ready', done);
375375
});
376376
});
377+
378+
it('set the timeout to socket_timeout after a connection has been established', function (done) {
379+
client = redis.createClient({
380+
parser: parser,
381+
connect_timeout: 1000,
382+
socket_timeout: 2000
383+
});
384+
process.nextTick(function () {
385+
assert.strictEqual(client.stream._idleTimeout, 1000);
386+
387+
});
388+
client.on('connect', function () {
389+
assert.strictEqual(client.stream._idleTimeout, 2000);
390+
assert.strictEqual(client.stream.listeners('timeout').length, 1);
391+
client.on('ready', done);
392+
});
393+
});
377394

378395
it('connect with host and port provided in the options object', function (done) {
379396
client = redis.createClient({

0 commit comments

Comments
 (0)