You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
fix incorrect code for eslint rules (#1367)
* fix code for eslint rules
This commit is contained in:
committed by
Ruben Bridgewater
parent
128ca62346
commit
50b4009005
@@ -187,12 +187,12 @@ describe("The 'batch' method", function () {
|
|||||||
['del', 'some set'],
|
['del', 'some set'],
|
||||||
['smembers', 'some set', undefined] // The explicit undefined is handled as a callback that is undefined
|
['smembers', 'some set', undefined] // The explicit undefined is handled as a callback that is undefined
|
||||||
])
|
])
|
||||||
.scard('some set')
|
.scard('some set')
|
||||||
.exec(function (err, replies) {
|
.exec(function (err, replies) {
|
||||||
assert.strictEqual(4, replies[0].length);
|
assert.strictEqual(4, replies[0].length);
|
||||||
assert.strictEqual(0, replies[2].length);
|
assert.strictEqual(0, replies[2].length);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows multiple operations to be performed using constructor with all kinds of syntax', function (done) {
|
it('allows multiple operations to be performed using constructor with all kinds of syntax', function (done) {
|
||||||
@@ -213,29 +213,29 @@ describe("The 'batch' method", function () {
|
|||||||
['HMSET', 'batchhmset', ['batchbar', 'batchbaz']],
|
['HMSET', 'batchhmset', ['batchbar', 'batchbaz']],
|
||||||
['hmset', 'batchhmset', ['batchbar', 'batchbaz'], helper.isString('OK')],
|
['hmset', 'batchhmset', ['batchbar', 'batchbaz'], helper.isString('OK')],
|
||||||
])
|
])
|
||||||
.hmget(now, 123456789, 'otherTypes')
|
.hmget(now, 123456789, 'otherTypes')
|
||||||
.hmget('key2', arr2, function noop () {})
|
.hmget('key2', arr2, function noop () {})
|
||||||
.hmget(['batchhmset2', 'some manner of key', 'batchbar3'])
|
.hmget(['batchhmset2', 'some manner of key', 'batchbar3'])
|
||||||
.mget('batchfoo2', ['batchfoo3', 'batchfoo'], function (err, res) {
|
.mget('batchfoo2', ['batchfoo3', 'batchfoo'], function (err, res) {
|
||||||
assert.strictEqual(res[0], 'batchbar2');
|
assert.strictEqual(res[0], 'batchbar2');
|
||||||
assert.strictEqual(res[1], 'batchbar3');
|
assert.strictEqual(res[1], 'batchbar3');
|
||||||
assert.strictEqual(res[2], null);
|
assert.strictEqual(res[2], null);
|
||||||
})
|
})
|
||||||
.exec(function (err, replies) {
|
.exec(function (err, replies) {
|
||||||
assert.equal(arr.length, 3);
|
assert.equal(arr.length, 3);
|
||||||
assert.equal(arr2.length, 2);
|
assert.equal(arr2.length, 2);
|
||||||
assert.equal(arr3.length, 3);
|
assert.equal(arr3.length, 3);
|
||||||
assert.equal(arr4.length, 3);
|
assert.equal(arr4.length, 3);
|
||||||
assert.strictEqual(null, err);
|
assert.strictEqual(null, err);
|
||||||
assert.equal(replies[10][1], '555');
|
assert.equal(replies[10][1], '555');
|
||||||
assert.equal(replies[11][0], 'a type of value');
|
assert.equal(replies[11][0], 'a type of value');
|
||||||
assert.strictEqual(replies[12][0], null);
|
assert.strictEqual(replies[12][0], null);
|
||||||
assert.equal(replies[12][1], 'test');
|
assert.equal(replies[12][1], 'test');
|
||||||
assert.equal(replies[13][0], 'batchbar2');
|
assert.equal(replies[13][0], 'batchbar2');
|
||||||
assert.equal(replies[13].length, 3);
|
assert.equal(replies[13].length, 3);
|
||||||
assert.equal(replies.length, 14);
|
assert.equal(replies.length, 14);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('converts a non string key to a string', function (done) {
|
it('converts a non string key to a string', function (done) {
|
||||||
@@ -316,11 +316,11 @@ describe("The 'batch' method", function () {
|
|||||||
['mget', ['batchfoo', 'some', 'random value', 'keys']],
|
['mget', ['batchfoo', 'some', 'random value', 'keys']],
|
||||||
['incr', 'batchfoo']
|
['incr', 'batchfoo']
|
||||||
])
|
])
|
||||||
.exec(function (err, replies) {
|
.exec(function (err, replies) {
|
||||||
assert.strictEqual(replies.length, 2);
|
assert.strictEqual(replies.length, 2);
|
||||||
assert.strictEqual(replies[0].length, 4);
|
assert.strictEqual(replies[0].length, 4);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows multiple operations to be performed on a hash', function (done) {
|
it('allows multiple operations to be performed on a hash', function (done) {
|
||||||
|
@@ -72,7 +72,7 @@ describe("The 'select' method", function () {
|
|||||||
assert.strictEqual(client.selected_db, undefined, 'default db should be undefined');
|
assert.strictEqual(client.selected_db, undefined, 'default db should be undefined');
|
||||||
client.select(9999, function (err) {
|
client.select(9999, function (err) {
|
||||||
assert.equal(err.code, 'ERR');
|
assert.equal(err.code, 'ERR');
|
||||||
assert((err.message == 'ERR DB index is out of range' || err.message == 'ERR invalid DB index'));
|
assert((err.message === 'ERR DB index is out of range' || err.message === 'ERR invalid DB index'));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -97,7 +97,7 @@ describe("The 'select' method", function () {
|
|||||||
|
|
||||||
client.on('error', function (err) {
|
client.on('error', function (err) {
|
||||||
assert.strictEqual(err.command, 'SELECT');
|
assert.strictEqual(err.command, 'SELECT');
|
||||||
assert((err.message == 'ERR DB index is out of range' || err.message == 'ERR invalid DB index'));
|
assert((err.message === 'ERR DB index is out of range' || err.message === 'ERR invalid DB index'));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -376,7 +376,7 @@ describe('connection tests', function () {
|
|||||||
var add = process.platform !== 'win32' ? 15 : 200;
|
var add = process.platform !== 'win32' ? 15 : 200;
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
assert(now - time < connect_timeout + add, 'The real timeout time should be below ' + (connect_timeout + add) + 'ms but is: ' + (now - time));
|
assert(now - time < connect_timeout + add, 'The real timeout time should be below ' + (connect_timeout + add) + 'ms but is: ' + (now - time));
|
||||||
// Timers sometimes trigger early (e.g. 1ms to early)
|
// Timers sometimes trigger early (e.g. 1ms to early)
|
||||||
assert(now - time >= connect_timeout - 5, 'The real timeout time should be above ' + connect_timeout + 'ms, but it is: ' + (now - time));
|
assert(now - time >= connect_timeout - 5, 'The real timeout time should be above ' + connect_timeout + 'ms, but it is: ' + (now - time));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@@ -27,20 +27,21 @@ function waitForRedis (available, cb, port) {
|
|||||||
bluebird.join(
|
bluebird.join(
|
||||||
tcpPortUsed.check(port, '127.0.0.1'),
|
tcpPortUsed.check(port, '127.0.0.1'),
|
||||||
tcpPortUsed.check(port, '::1'),
|
tcpPortUsed.check(port, '::1'),
|
||||||
function (ipV4, ipV6) {
|
function (ipV4, ipV6) {
|
||||||
if (ipV6 === available && ipV4 === available) {
|
if (ipV6 === available && ipV4 === available) {
|
||||||
if (fs.existsSync(socket) === available) {
|
if (fs.existsSync(socket) === available) {
|
||||||
clearInterval(id);
|
clearInterval(id);
|
||||||
return cb();
|
return cb();
|
||||||
|
}
|
||||||
|
// The same message applies for can't stop but we ignore that case
|
||||||
|
throw new Error('Port ' + port + ' is already in use. Tests can\'t start.\n');
|
||||||
}
|
}
|
||||||
// The same message applies for can't stop but we ignore that case
|
if (Date.now() - time > 6000) {
|
||||||
throw new Error('Port ' + port + ' is already in use. Tests can\'t start.\n');
|
throw new Error('Redis could not start on port ' + (port || config.PORT) + '\n');
|
||||||
|
}
|
||||||
|
running = false;
|
||||||
}
|
}
|
||||||
if (Date.now() - time > 6000) {
|
).catch(function (err) {
|
||||||
throw new Error('Redis could not start on port ' + (port || config.PORT) + '\n');
|
|
||||||
}
|
|
||||||
running = false;
|
|
||||||
}).catch(function (err) {
|
|
||||||
console.error('\x1b[31m' + err.stack + '\x1b[0m\n');
|
console.error('\x1b[31m' + err.stack + '\x1b[0m\n');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
@@ -379,12 +379,12 @@ describe("The 'multi' method", function () {
|
|||||||
['del', 'some set'],
|
['del', 'some set'],
|
||||||
['smembers', 'some set']
|
['smembers', 'some set']
|
||||||
])
|
])
|
||||||
.scard('some set')
|
.scard('some set')
|
||||||
.exec(function (err, replies) {
|
.exec(function (err, replies) {
|
||||||
assert.strictEqual(4, replies[0].length);
|
assert.strictEqual(4, replies[0].length);
|
||||||
assert.strictEqual(0, replies[2].length);
|
assert.strictEqual(0, replies[2].length);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows multiple operations to be performed using constructor with all kinds of syntax', function (done) {
|
it('allows multiple operations to be performed using constructor with all kinds of syntax', function (done) {
|
||||||
@@ -406,30 +406,30 @@ describe("The 'multi' method", function () {
|
|||||||
['HMSET', 'multihmset', ['multibar', 'multibaz'], undefined], // undefined is used as a explicit not set callback variable
|
['HMSET', 'multihmset', ['multibar', 'multibaz'], undefined], // undefined is used as a explicit not set callback variable
|
||||||
['hmset', 'multihmset', ['multibar', 'multibaz'], helper.isString('OK')],
|
['hmset', 'multihmset', ['multibar', 'multibaz'], helper.isString('OK')],
|
||||||
])
|
])
|
||||||
.hmget(now, 123456789, 'otherTypes')
|
.hmget(now, 123456789, 'otherTypes')
|
||||||
.hmget('key2', arr2, function noop () {})
|
.hmget('key2', arr2, function noop () {})
|
||||||
.hmget(['multihmset2', 'some manner of key', 'multibar3'])
|
.hmget(['multihmset2', 'some manner of key', 'multibar3'])
|
||||||
.mget('multifoo2', ['multifoo3', 'multifoo'], function (err, res) {
|
.mget('multifoo2', ['multifoo3', 'multifoo'], function (err, res) {
|
||||||
assert(res[0], 'multifoo3');
|
assert(res[0], 'multifoo3');
|
||||||
assert(res[1], 'multifoo');
|
assert(res[1], 'multifoo');
|
||||||
called = true;
|
called = true;
|
||||||
})
|
})
|
||||||
.exec(function (err, replies) {
|
.exec(function (err, replies) {
|
||||||
assert(called);
|
assert(called);
|
||||||
assert.equal(arr.length, 3);
|
assert.equal(arr.length, 3);
|
||||||
assert.equal(arr2.length, 2);
|
assert.equal(arr2.length, 2);
|
||||||
assert.equal(arr3.length, 3);
|
assert.equal(arr3.length, 3);
|
||||||
assert.equal(arr4.length, 3);
|
assert.equal(arr4.length, 3);
|
||||||
assert.strictEqual(null, err);
|
assert.strictEqual(null, err);
|
||||||
assert.equal(replies[10][1], '555');
|
assert.equal(replies[10][1], '555');
|
||||||
assert.equal(replies[11][0], 'a type of value');
|
assert.equal(replies[11][0], 'a type of value');
|
||||||
assert.strictEqual(replies[12][0], null);
|
assert.strictEqual(replies[12][0], null);
|
||||||
assert.equal(replies[12][1], 'test');
|
assert.equal(replies[12][1], 'test');
|
||||||
assert.equal(replies[13][0], 'multibar2');
|
assert.equal(replies[13][0], 'multibar2');
|
||||||
assert.equal(replies[13].length, 3);
|
assert.equal(replies[13].length, 3);
|
||||||
assert.equal(replies.length, 14);
|
assert.equal(replies.length, 14);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('converts a non string key to a string', function (done) {
|
it('converts a non string key to a string', function (done) {
|
||||||
@@ -505,11 +505,11 @@ describe("The 'multi' method", function () {
|
|||||||
['mget', ['multifoo', 'some', 'random value', 'keys']],
|
['mget', ['multifoo', 'some', 'random value', 'keys']],
|
||||||
['incr', 'multifoo']
|
['incr', 'multifoo']
|
||||||
])
|
])
|
||||||
.exec(function (err, replies) {
|
.exec(function (err, replies) {
|
||||||
assert.strictEqual(replies.length, 2);
|
assert.strictEqual(replies.length, 2);
|
||||||
assert.strictEqual(replies[0].length, 4);
|
assert.strictEqual(replies[0].length, 4);
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('allows multiple operations to be performed on a hash', function (done) {
|
it('allows multiple operations to be performed on a hash', function (done) {
|
||||||
|
@@ -122,7 +122,7 @@ describe('The node_redis client', function () {
|
|||||||
it('check if all new options replaced the old ones', function (done) {
|
it('check if all new options replaced the old ones', function (done) {
|
||||||
client.selected_db = 1;
|
client.selected_db = 1;
|
||||||
var client2 = client.duplicate({
|
var client2 = client.duplicate({
|
||||||
db: 2,
|
db: 2,
|
||||||
no_ready_check: true
|
no_ready_check: true
|
||||||
});
|
});
|
||||||
assert(client.connected);
|
assert(client.connected);
|
||||||
|
@@ -110,17 +110,17 @@ describe('TLS connection tests', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('using rediss as url protocol', function (done) {
|
describe('using rediss as url protocol', function (done) {
|
||||||
var tls_connect = tls.connect
|
var tls_connect = tls.connect;
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
tls.connect = function (options) {
|
tls.connect = function (options) {
|
||||||
options = utils.clone(options)
|
options = utils.clone(options);
|
||||||
options.ca = tls_options.ca;
|
options.ca = tls_options.ca;
|
||||||
return tls_connect.call(tls, options);
|
return tls_connect.call(tls, options);
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
tls.connect = tls_connect;
|
tls.connect = tls_connect;
|
||||||
})
|
});
|
||||||
it('connect with tls when rediss is used as the protocol', function (done) {
|
it('connect with tls when rediss is used as the protocol', function (done) {
|
||||||
if (skip) this.skip();
|
if (skip) this.skip();
|
||||||
client = redis.createClient('rediss://localhost:' + tls_port);
|
client = redis.createClient('rediss://localhost:' + tls_port);
|
||||||
@@ -129,7 +129,7 @@ describe('TLS connection tests', function () {
|
|||||||
client.set('foo', 'bar');
|
client.set('foo', 'bar');
|
||||||
client.get('foo', helper.isString('bar', done));
|
client.get('foo', helper.isString('bar', done));
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
it('fails to connect because the cert is not correct', function (done) {
|
it('fails to connect because the cert is not correct', function (done) {
|
||||||
if (skip) this.skip();
|
if (skip) this.skip();
|
||||||
|
Reference in New Issue
Block a user