Skip to content

Commit 50b4009

Browse files
jinhyukifyBridgeAR
authored andcommitted
fix incorrect code for eslint rules (#1367)
* fix code for eslint rules
1 parent 128ca62 commit 50b4009

File tree

7 files changed

+92
-91
lines changed

7 files changed

+92
-91
lines changed

test/batch.spec.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ describe("The 'batch' method", function () {
187187
['del', 'some set'],
188188
['smembers', 'some set', undefined] // The explicit undefined is handled as a callback that is undefined
189189
])
190-
.scard('some set')
191-
.exec(function (err, replies) {
192-
assert.strictEqual(4, replies[0].length);
193-
assert.strictEqual(0, replies[2].length);
194-
return done();
195-
});
190+
.scard('some set')
191+
.exec(function (err, replies) {
192+
assert.strictEqual(4, replies[0].length);
193+
assert.strictEqual(0, replies[2].length);
194+
return done();
195+
});
196196
});
197197

198198
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 () {
213213
['HMSET', 'batchhmset', ['batchbar', 'batchbaz']],
214214
['hmset', 'batchhmset', ['batchbar', 'batchbaz'], helper.isString('OK')],
215215
])
216-
.hmget(now, 123456789, 'otherTypes')
217-
.hmget('key2', arr2, function noop () {})
218-
.hmget(['batchhmset2', 'some manner of key', 'batchbar3'])
219-
.mget('batchfoo2', ['batchfoo3', 'batchfoo'], function (err, res) {
220-
assert.strictEqual(res[0], 'batchbar2');
221-
assert.strictEqual(res[1], 'batchbar3');
222-
assert.strictEqual(res[2], null);
223-
})
224-
.exec(function (err, replies) {
225-
assert.equal(arr.length, 3);
226-
assert.equal(arr2.length, 2);
227-
assert.equal(arr3.length, 3);
228-
assert.equal(arr4.length, 3);
229-
assert.strictEqual(null, err);
230-
assert.equal(replies[10][1], '555');
231-
assert.equal(replies[11][0], 'a type of value');
232-
assert.strictEqual(replies[12][0], null);
233-
assert.equal(replies[12][1], 'test');
234-
assert.equal(replies[13][0], 'batchbar2');
235-
assert.equal(replies[13].length, 3);
236-
assert.equal(replies.length, 14);
237-
return done();
238-
});
216+
.hmget(now, 123456789, 'otherTypes')
217+
.hmget('key2', arr2, function noop () {})
218+
.hmget(['batchhmset2', 'some manner of key', 'batchbar3'])
219+
.mget('batchfoo2', ['batchfoo3', 'batchfoo'], function (err, res) {
220+
assert.strictEqual(res[0], 'batchbar2');
221+
assert.strictEqual(res[1], 'batchbar3');
222+
assert.strictEqual(res[2], null);
223+
})
224+
.exec(function (err, replies) {
225+
assert.equal(arr.length, 3);
226+
assert.equal(arr2.length, 2);
227+
assert.equal(arr3.length, 3);
228+
assert.equal(arr4.length, 3);
229+
assert.strictEqual(null, err);
230+
assert.equal(replies[10][1], '555');
231+
assert.equal(replies[11][0], 'a type of value');
232+
assert.strictEqual(replies[12][0], null);
233+
assert.equal(replies[12][1], 'test');
234+
assert.equal(replies[13][0], 'batchbar2');
235+
assert.equal(replies[13].length, 3);
236+
assert.equal(replies.length, 14);
237+
return done();
238+
});
239239
});
240240

241241
it('converts a non string key to a string', function (done) {
@@ -316,11 +316,11 @@ describe("The 'batch' method", function () {
316316
['mget', ['batchfoo', 'some', 'random value', 'keys']],
317317
['incr', 'batchfoo']
318318
])
319-
.exec(function (err, replies) {
320-
assert.strictEqual(replies.length, 2);
321-
assert.strictEqual(replies[0].length, 4);
322-
return done();
323-
});
319+
.exec(function (err, replies) {
320+
assert.strictEqual(replies.length, 2);
321+
assert.strictEqual(replies[0].length, 4);
322+
return done();
323+
});
324324
});
325325

326326
it('allows multiple operations to be performed on a hash', function (done) {

test/commands/select.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe("The 'select' method", function () {
7272
assert.strictEqual(client.selected_db, undefined, 'default db should be undefined');
7373
client.select(9999, function (err) {
7474
assert.equal(err.code, 'ERR');
75-
assert((err.message == 'ERR DB index is out of range' || err.message == 'ERR invalid DB index'));
75+
assert((err.message === 'ERR DB index is out of range' || err.message === 'ERR invalid DB index'));
7676
done();
7777
});
7878
});
@@ -97,7 +97,7 @@ describe("The 'select' method", function () {
9797

9898
client.on('error', function (err) {
9999
assert.strictEqual(err.command, 'SELECT');
100-
assert((err.message == 'ERR DB index is out of range' || err.message == 'ERR invalid DB index'));
100+
assert((err.message === 'ERR DB index is out of range' || err.message === 'ERR invalid DB index'));
101101
done();
102102
});
103103

test/connection.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ describe('connection tests', function () {
376376
var add = process.platform !== 'win32' ? 15 : 200;
377377
var now = Date.now();
378378
assert(now - time < connect_timeout + add, 'The real timeout time should be below ' + (connect_timeout + add) + 'ms but is: ' + (now - time));
379-
// Timers sometimes trigger early (e.g. 1ms to early)
379+
// Timers sometimes trigger early (e.g. 1ms to early)
380380
assert(now - time >= connect_timeout - 5, 'The real timeout time should be above ' + connect_timeout + 'ms, but it is: ' + (now - time));
381381
done();
382382
});

test/lib/redis-process.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,21 @@ function waitForRedis (available, cb, port) {
2727
bluebird.join(
2828
tcpPortUsed.check(port, '127.0.0.1'),
2929
tcpPortUsed.check(port, '::1'),
30-
function (ipV4, ipV6) {
31-
if (ipV6 === available && ipV4 === available) {
32-
if (fs.existsSync(socket) === available) {
33-
clearInterval(id);
34-
return cb();
30+
function (ipV4, ipV6) {
31+
if (ipV6 === available && ipV4 === available) {
32+
if (fs.existsSync(socket) === available) {
33+
clearInterval(id);
34+
return cb();
35+
}
36+
// The same message applies for can't stop but we ignore that case
37+
throw new Error('Port ' + port + ' is already in use. Tests can\'t start.\n');
3538
}
36-
// The same message applies for can't stop but we ignore that case
37-
throw new Error('Port ' + port + ' is already in use. Tests can\'t start.\n');
38-
}
39-
if (Date.now() - time > 6000) {
40-
throw new Error('Redis could not start on port ' + (port || config.PORT) + '\n');
39+
if (Date.now() - time > 6000) {
40+
throw new Error('Redis could not start on port ' + (port || config.PORT) + '\n');
41+
}
42+
running = false;
4143
}
42-
running = false;
43-
}).catch(function (err) {
44+
).catch(function (err) {
4445
console.error('\x1b[31m' + err.stack + '\x1b[0m\n');
4546
process.exit(1);
4647
});

test/multi.spec.js

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,12 @@ describe("The 'multi' method", function () {
379379
['del', 'some set'],
380380
['smembers', 'some set']
381381
])
382-
.scard('some set')
383-
.exec(function (err, replies) {
384-
assert.strictEqual(4, replies[0].length);
385-
assert.strictEqual(0, replies[2].length);
386-
return done();
387-
});
382+
.scard('some set')
383+
.exec(function (err, replies) {
384+
assert.strictEqual(4, replies[0].length);
385+
assert.strictEqual(0, replies[2].length);
386+
return done();
387+
});
388388
});
389389

390390
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 () {
406406
['HMSET', 'multihmset', ['multibar', 'multibaz'], undefined], // undefined is used as a explicit not set callback variable
407407
['hmset', 'multihmset', ['multibar', 'multibaz'], helper.isString('OK')],
408408
])
409-
.hmget(now, 123456789, 'otherTypes')
410-
.hmget('key2', arr2, function noop () {})
411-
.hmget(['multihmset2', 'some manner of key', 'multibar3'])
412-
.mget('multifoo2', ['multifoo3', 'multifoo'], function (err, res) {
413-
assert(res[0], 'multifoo3');
414-
assert(res[1], 'multifoo');
415-
called = true;
416-
})
417-
.exec(function (err, replies) {
418-
assert(called);
419-
assert.equal(arr.length, 3);
420-
assert.equal(arr2.length, 2);
421-
assert.equal(arr3.length, 3);
422-
assert.equal(arr4.length, 3);
423-
assert.strictEqual(null, err);
424-
assert.equal(replies[10][1], '555');
425-
assert.equal(replies[11][0], 'a type of value');
426-
assert.strictEqual(replies[12][0], null);
427-
assert.equal(replies[12][1], 'test');
428-
assert.equal(replies[13][0], 'multibar2');
429-
assert.equal(replies[13].length, 3);
430-
assert.equal(replies.length, 14);
431-
return done();
432-
});
409+
.hmget(now, 123456789, 'otherTypes')
410+
.hmget('key2', arr2, function noop () {})
411+
.hmget(['multihmset2', 'some manner of key', 'multibar3'])
412+
.mget('multifoo2', ['multifoo3', 'multifoo'], function (err, res) {
413+
assert(res[0], 'multifoo3');
414+
assert(res[1], 'multifoo');
415+
called = true;
416+
})
417+
.exec(function (err, replies) {
418+
assert(called);
419+
assert.equal(arr.length, 3);
420+
assert.equal(arr2.length, 2);
421+
assert.equal(arr3.length, 3);
422+
assert.equal(arr4.length, 3);
423+
assert.strictEqual(null, err);
424+
assert.equal(replies[10][1], '555');
425+
assert.equal(replies[11][0], 'a type of value');
426+
assert.strictEqual(replies[12][0], null);
427+
assert.equal(replies[12][1], 'test');
428+
assert.equal(replies[13][0], 'multibar2');
429+
assert.equal(replies[13].length, 3);
430+
assert.equal(replies.length, 14);
431+
return done();
432+
});
433433
});
434434

435435
it('converts a non string key to a string', function (done) {
@@ -505,11 +505,11 @@ describe("The 'multi' method", function () {
505505
['mget', ['multifoo', 'some', 'random value', 'keys']],
506506
['incr', 'multifoo']
507507
])
508-
.exec(function (err, replies) {
509-
assert.strictEqual(replies.length, 2);
510-
assert.strictEqual(replies[0].length, 4);
511-
return done();
512-
});
508+
.exec(function (err, replies) {
509+
assert.strictEqual(replies.length, 2);
510+
assert.strictEqual(replies[0].length, 4);
511+
return done();
512+
});
513513
});
514514

515515
it('allows multiple operations to be performed on a hash', function (done) {

test/node_redis.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe('The node_redis client', function () {
122122
it('check if all new options replaced the old ones', function (done) {
123123
client.selected_db = 1;
124124
var client2 = client.duplicate({
125-
db: 2,
125+
db: 2,
126126
no_ready_check: true
127127
});
128128
assert(client.connected);

test/tls.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,17 @@ describe('TLS connection tests', function () {
110110
});
111111

112112
describe('using rediss as url protocol', function (done) {
113-
var tls_connect = tls.connect
113+
var tls_connect = tls.connect;
114114
beforeEach(function () {
115115
tls.connect = function (options) {
116-
options = utils.clone(options)
116+
options = utils.clone(options);
117117
options.ca = tls_options.ca;
118118
return tls_connect.call(tls, options);
119-
}
120-
})
119+
};
120+
});
121121
afterEach(function () {
122122
tls.connect = tls_connect;
123-
})
123+
});
124124
it('connect with tls when rediss is used as the protocol', function (done) {
125125
if (skip) this.skip();
126126
client = redis.createClient('rediss://localhost:' + tls_port);
@@ -129,7 +129,7 @@ describe('TLS connection tests', function () {
129129
client.set('foo', 'bar');
130130
client.get('foo', helper.isString('bar', done));
131131
});
132-
})
132+
});
133133

134134
it('fails to connect because the cert is not correct', function (done) {
135135
if (skip) this.skip();

0 commit comments

Comments
 (0)