1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

chore: mark private variables as such and remove obsolete ones

This commit is contained in:
Ruben Bridgewater
2017-05-28 07:15:20 +02:00
parent ba7a39c443
commit b2e18344d9
21 changed files with 179 additions and 165 deletions

View File

@@ -46,27 +46,27 @@ describe('The \'client\' method', () => {
describe('as normal command', () => {
it('on', function () {
helper.serverVersionAtLeast.call(this, client, [3, 2, 0])
assert.strictEqual(client.reply, 'ON')
assert.strictEqual(client._reply, 'ON')
const promises = [client.client('reply', 'on').then(helper.isString('OK'))]
assert.strictEqual(client.reply, 'ON')
assert.strictEqual(client._reply, 'ON')
promises.push(client.set('foo', 'bar'))
return Promise.all(promises)
})
it('off', function () {
helper.serverVersionAtLeast.call(this, client, [3, 2, 0])
assert.strictEqual(client.reply, 'ON')
assert.strictEqual(client._reply, 'ON')
const promises = [client.client(Buffer.from('REPLY'), 'OFF').then(helper.isUndefined())]
assert.strictEqual(client.reply, 'OFF')
assert.strictEqual(client._reply, 'OFF')
promises.push(client.set('foo', 'bar').then(helper.isUndefined()))
return Promise.all(promises)
})
it('skip', function () {
helper.serverVersionAtLeast.call(this, client, [3, 2, 0])
assert.strictEqual(client.reply, 'ON')
assert.strictEqual(client._reply, 'ON')
const promises = [client.client('REPLY', Buffer.from('SKIP')).then(helper.isUndefined())]
assert.strictEqual(client.reply, 'SKIP_ONE_MORE')
assert.strictEqual(client._reply, 'SKIP_ONE_MORE')
promises.push(client.set('foo', 'bar').then(helper.isUndefined()))
promises.push(client.get('foo').then(helper.isString('bar')))
return Promise.all(promises)
@@ -77,9 +77,9 @@ describe('The \'client\' method', () => {
it('on', function () {
helper.serverVersionAtLeast.call(this, client, [3, 2, 0])
const batch = client.batch()
assert.strictEqual(client.reply, 'ON')
assert.strictEqual(client._reply, 'ON')
batch.client('reply', 'on')
assert.strictEqual(client.reply, 'ON')
assert.strictEqual(client._reply, 'ON')
batch.set('foo', 'bar')
return batch.exec().then(helper.isDeepEqual(['OK', 'OK']))
})
@@ -87,20 +87,20 @@ describe('The \'client\' method', () => {
it('off', function () {
helper.serverVersionAtLeast.call(this, client, [3, 2, 0])
const batch = client.batch()
assert.strictEqual(client.reply, 'ON')
assert.strictEqual(client._reply, 'ON')
batch.set('hello', 'world')
batch.client(Buffer.from('REPLY'), Buffer.from('OFF'))
batch.get('hello')
batch.get('hello')
return batch.exec().then((res) => {
assert.strictEqual(client.reply, 'OFF')
assert.strictEqual(client._reply, 'OFF')
assert.deepStrictEqual(res, ['OK', undefined, undefined, undefined])
})
})
it('skip', function () {
helper.serverVersionAtLeast.call(this, client, [3, 2, 0])
assert.strictEqual(client.reply, 'ON')
assert.strictEqual(client._reply, 'ON')
return client.batch()
.set('hello', 'world')
.client('REPLY', 'SKIP')
@@ -108,7 +108,7 @@ describe('The \'client\' method', () => {
.get('foo')
.exec()
.then((res) => {
assert.strictEqual(client.reply, 'ON')
assert.strictEqual(client._reply, 'ON')
assert.deepStrictEqual(res, ['OK', undefined, undefined, 'bar'])
})
})

View File

@@ -62,7 +62,7 @@ describe('The \'monitor\' method', () => {
})
monitorClient.on('monitor', (time, args, rawOutput) => {
assert.strictEqual(monitorClient.monitoring, true)
assert.strictEqual(monitorClient._monitoring, true)
assert.deepStrictEqual(args, responses.shift())
assert(utils.monitorRegex.test(rawOutput), rawOutput)
if (responses.length === 0) {
@@ -81,7 +81,7 @@ describe('The \'monitor\' method', () => {
})
monitorClient.monitor().then((res) => {
assert.strictEqual(monitorClient.monitoring, true)
assert.strictEqual(monitorClient._monitoring, true)
assert.strictEqual(res.inspect(), Buffer.from('OK').inspect())
monitorClient.mget('hello', Buffer.from('world'))
})
@@ -100,7 +100,7 @@ describe('The \'monitor\' method', () => {
client.monitor().then(helper.isString('OK'))
client.mget('hello', 'world')
client.on('monitor', (time, args, rawOutput) => {
assert.strictEqual(client.monitoring, true)
assert.strictEqual(client._monitoring, true)
assert(utils.monitorRegex.test(rawOutput), rawOutput)
assert.deepStrictEqual(args, ['mget', 'hello', 'world'])
if (called) {
@@ -120,7 +120,7 @@ describe('The \'monitor\' method', () => {
multi.mget('hello', 'world')
multi.exec().then(helper.isDeepEqual(['OK', [null, null]]))
client.on('monitor', (time, args, rawOutput) => {
assert.strictEqual(client.monitoring, true)
assert.strictEqual(client._monitoring, true)
assert(utils.monitorRegex.test(rawOutput), rawOutput)
assert.deepStrictEqual(args, ['mget', 'hello', 'world'])
if (called) {
@@ -141,12 +141,12 @@ describe('The \'monitor\' method', () => {
client._stream.destroy()
const end = helper.callFuncAfter(done, 2)
client.on('monitor', (time, args, rawOutput) => {
assert.strictEqual(client.monitoring, true)
assert.strictEqual(client._monitoring, true)
end()
})
client.on('reconnecting', () => {
client.get('foo').then((res) => {
assert.strictEqual(client.monitoring, true)
assert.strictEqual(client._monitoring, true)
end()
})
})