Skip to content

Commit d1d012a

Browse files
committed
Fix tests
1 parent 3eea37d commit d1d012a

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

test/connection.spec.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,20 +395,38 @@ describe('connection tests', function () {
395395
});
396396
});
397397

398-
it('clears the socket timeout after a connection has been established', function (done) {
398+
it('clears connect_timeout on the socket timeout after a connection has been established', function (done) {
399399
client = redis.createClient({
400400
parser: parser,
401401
connect_timeout: 1000
402402
});
403403
process.nextTick(function () {
404404
assert.strictEqual(client.stream._idleTimeout, 1000);
405+
405406
});
406407
client.on('connect', function () {
407408
assert.strictEqual(client.stream._idleTimeout, -1);
408409
assert.strictEqual(client.stream.listeners('timeout').length, 0);
409410
client.on('ready', done);
410411
});
411412
});
413+
414+
it('set the timeout to socket_timeout after a connection has been established', function (done) {
415+
client = redis.createClient({
416+
parser: parser,
417+
connect_timeout: 1000,
418+
socket_timeout: 2000
419+
});
420+
process.nextTick(function () {
421+
assert.strictEqual(client.stream._idleTimeout, 1000);
422+
423+
});
424+
client.on('connect', function () {
425+
assert.strictEqual(client.stream._idleTimeout, 2000);
426+
assert.strictEqual(client.stream.listeners('timeout').length, 1);
427+
client.on('ready', done);
428+
});
429+
});
412430

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

test/node_redis.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ describe('The node_redis client', function () {
359359

360360
it('send_command with callback as args', function (done) {
361361
client.send_command('abcdef', function (err, res) {
362-
assert.strictEqual(err.message, "ERR unknown command 'abcdef'");
362+
assert.strictEqual(err.message, "ERR unknown command `abcdef`, with args beginning with: ");
363363
done();
364364
});
365365
});

test/rename.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('rename commands', function () {
5050
});
5151

5252
client.get('key', function (err, reply) {
53-
assert.strictEqual(err.message, "ERR unknown command 'get'");
53+
assert.strictEqual(err.message, "ERR unknown command `get`, with args beginning with: `key`, ");
5454
assert.strictEqual(err.command, 'GET');
5555
assert.strictEqual(reply, undefined);
5656
});
@@ -108,7 +108,7 @@ describe('rename commands', function () {
108108
multi.exec(function (err, res) {
109109
assert(err);
110110
assert.strictEqual(err.message, 'EXECABORT Transaction discarded because of previous errors.');
111-
assert.strictEqual(err.errors[0].message, "ERR unknown command 'get'");
111+
assert.strictEqual(err.errors[0].message, "ERR unknown command `get`, with args beginning with: `key`, ");
112112
assert.strictEqual(err.errors[0].command, 'GET');
113113
assert.strictEqual(err.code, 'EXECABORT');
114114
assert.strictEqual(err.errors[0].code, 'ERR');

0 commit comments

Comments
 (0)