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

feat: parse info data as numbers if possible and improve parsing

This commit is contained in:
Ruben Bridgewater
2017-05-28 00:12:36 +02:00
parent 8da9e98fe6
commit 8c63233968
14 changed files with 91 additions and 65 deletions

View File

@@ -22,11 +22,11 @@ describe('The \'info\' method', () => {
it('update serverInfo after a info command', () => {
client.set('foo', 'bar')
return client.info().then(() => {
assert.strictEqual(client.serverInfo.db2, undefined)
assert.strictEqual(client.serverInfo.keyspace.db2, undefined)
client.select(2)
client.set('foo', 'bar')
return client.info().then(() => {
assert.strictEqual(typeof client.serverInfo.db2, 'object')
assert.strictEqual(typeof client.serverInfo.keyspace.db2, 'object')
})
})
})
@@ -35,14 +35,15 @@ describe('The \'info\' method', () => {
client.set('foo', 'bar')
client.info('keyspace')
return client.select(2).then(() => {
assert.strictEqual(Object.keys(client.serverInfo).length, 2, 'Key length should be three')
assert.strictEqual(typeof client.serverInfo.db0, 'object', 'db0 keyspace should be an object')
assert.strictEqual(Object.keys(client.serverInfo).length, 1, 'Key length should be one')
assert.strictEqual(Object.keys(client.serverInfo.keyspace.db0).length, 3, 'Key length should be three')
assert.strictEqual(typeof client.serverInfo.keyspace.db0, 'object', 'db0 keyspace should be an object')
client.info(['keyspace'])
client.set('foo', 'bar')
return client.info('all').then((res) => {
assert(Object.keys(client.serverInfo).length > 3, 'Key length should be way above three')
assert.strictEqual(typeof client.serverInfo.redis_version, 'string')
assert.strictEqual(typeof client.serverInfo.db2, 'object')
assert.strictEqual(typeof client.serverInfo.server.redis_version, 'string')
assert.strictEqual(typeof client.serverInfo.keyspace.db2, 'object')
})
})
})