You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Remove snack_case and always use camelCase
This commit is contained in:
committed by
Ruben Bridgewater
parent
a86c998a64
commit
28afc33c9a
@@ -23,7 +23,7 @@ describe("The 'blpop' method", function () {
|
||||
|
||||
it('pops value immediately if list contains values', function (done) {
|
||||
bclient = redis.createClient.apply(null, args);
|
||||
redis.debug_mode = true;
|
||||
redis.debugMode = true;
|
||||
var text = '';
|
||||
var unhookIntercept = intercept(function (data) {
|
||||
text += data;
|
||||
@@ -32,7 +32,7 @@ describe("The 'blpop' method", function () {
|
||||
client.rpush('blocking list', 'initial value', helper.isNumber(1));
|
||||
unhookIntercept();
|
||||
assert(/^Send 127\.0\.0\.1:6379 id [0-9]+: \*3\r\n\$5\r\nrpush\r\n\$13\r\nblocking list\r\n\$13\r\ninitial value\r\n\n$/.test(text));
|
||||
redis.debug_mode = false;
|
||||
redis.debugMode = false;
|
||||
bclient.blpop('blocking list', 0, function (err, value) {
|
||||
assert.strictEqual(value[0], 'blocking list');
|
||||
assert.strictEqual(value[1], 'initial value');
|
||||
|
@@ -33,8 +33,8 @@ describe("The 'hgetall' method", function () {
|
||||
});
|
||||
|
||||
it('handles fetching keys set using an object', function (done) {
|
||||
client.batch().HMSET('msg_test', { message: 'hello' }, undefined).exec();
|
||||
client.hgetall('msg_test', function (err, obj) {
|
||||
client.batch().HMSET('msgTest', { message: 'hello' }, undefined).exec();
|
||||
client.hgetall('msgTest', function (err, obj) {
|
||||
assert.strictEqual(1, Object.keys(obj).length);
|
||||
assert.strictEqual(obj.message, 'hello');
|
||||
done(err);
|
||||
@@ -52,7 +52,7 @@ describe("The 'hgetall' method", function () {
|
||||
describe('binary client', function () {
|
||||
var client;
|
||||
var args = config.configureClient(ip, {
|
||||
return_buffers: true
|
||||
returnBuffers: true
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
|
@@ -52,7 +52,7 @@ describe("The 'incr' method", function () {
|
||||
});
|
||||
|
||||
it('count above the safe integers as strings', function (done) {
|
||||
args[2].string_numbers = true;
|
||||
args[2].stringNumbers = true;
|
||||
client = redis.createClient.apply(null, args);
|
||||
// Set a value to the maximum safe allowed javascript number (2^53)
|
||||
client.set(key, MAX_SAFE_INTEGER, helper.isNotError());
|
||||
|
@@ -41,24 +41,24 @@ describe("The 'info' method", function () {
|
||||
client.set('foo', 'bar');
|
||||
client.info('keyspace');
|
||||
client.select(2, function () {
|
||||
assert.strictEqual(Object.keys(client.server_info).length, 2, 'Key length should be three');
|
||||
assert.strictEqual(typeof client.server_info.db0, 'object', 'db0 keyspace should be an object');
|
||||
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');
|
||||
});
|
||||
client.info(['keyspace']);
|
||||
client.set('foo', 'bar');
|
||||
client.info('all', function (err, res) {
|
||||
assert(Object.keys(client.server_info).length > 3, 'Key length should be way above three');
|
||||
assert.strictEqual(typeof client.server_info.redis_version, 'string');
|
||||
assert.strictEqual(typeof client.server_info.db2, 'object');
|
||||
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');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('check redis v.2.4 support', function (done) {
|
||||
var end = helper.callFuncAfter(done, 2);
|
||||
client.internal_send_command = function (command_obj) {
|
||||
assert.strictEqual(command_obj.args.length, 0);
|
||||
assert.strictEqual(command_obj.command, 'info');
|
||||
client.internalSendCommand = function (commandObj) {
|
||||
assert.strictEqual(commandObj.args.length, 0);
|
||||
assert.strictEqual(commandObj.command, 'info');
|
||||
end();
|
||||
};
|
||||
client.info();
|
||||
|
@@ -31,22 +31,22 @@ describe("The 'keys' method", function () {
|
||||
});
|
||||
|
||||
it('handles a large packet size', function (done) {
|
||||
var keys_values = [];
|
||||
var keysValues = [];
|
||||
|
||||
for (var i = 0; i < 200; i++) {
|
||||
var key_value = [
|
||||
var keyValue = [
|
||||
'multibulk:' + crypto.randomBytes(256).toString('hex'), // use long strings as keys to ensure generation of large packet
|
||||
'test val ' + i
|
||||
];
|
||||
keys_values.push(key_value);
|
||||
keysValues.push(keyValue);
|
||||
}
|
||||
|
||||
client.mset(keys_values.reduce(function (a, b) {
|
||||
client.mset(keysValues.reduce(function (a, b) {
|
||||
return a.concat(b);
|
||||
}), helper.isString('OK'));
|
||||
|
||||
client.keys('multibulk:*', function (err, results) {
|
||||
assert.deepEqual(keys_values.map(function (val) {
|
||||
assert.deepEqual(keysValues.map(function (val) {
|
||||
return val[0];
|
||||
}).sort(), results.sort());
|
||||
return done(err);
|
||||
|
@@ -46,10 +46,10 @@ describe("The 'select' method", function () {
|
||||
|
||||
it('changes the database and calls the callback', function (done) {
|
||||
// default value of null means database 0 will be used.
|
||||
assert.strictEqual(client.selected_db, undefined, 'default db should be undefined');
|
||||
assert.strictEqual(client.selectedDb, undefined, 'default db should be undefined');
|
||||
var buffering = client.SELECT(1, function (err, res) {
|
||||
helper.isNotError()(err, res);
|
||||
assert.strictEqual(client.selected_db, 1, 'db should be 1 after select');
|
||||
assert.strictEqual(client.selectedDb, 1, 'db should be 1 after select');
|
||||
done();
|
||||
});
|
||||
assert(typeof buffering === 'boolean');
|
||||
@@ -58,10 +58,10 @@ describe("The 'select' method", function () {
|
||||
describe('and a callback is specified', function () {
|
||||
describe('with a valid db index', function () {
|
||||
it('selects the appropriate database', function (done) {
|
||||
assert.strictEqual(client.selected_db, undefined, 'default db should be undefined');
|
||||
assert.strictEqual(client.selectedDb, undefined, 'default db should be undefined');
|
||||
client.select(1, function (err) {
|
||||
assert.equal(err, null);
|
||||
assert.equal(client.selected_db, 1, 'we should have selected the new valid DB');
|
||||
assert.equal(client.selectedDb, 1, 'we should have selected the new valid DB');
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -69,7 +69,7 @@ describe("The 'select' method", function () {
|
||||
|
||||
describe('with an invalid db index', function () {
|
||||
it('returns an error', function (done) {
|
||||
assert.strictEqual(client.selected_db, undefined, 'default db should be undefined');
|
||||
assert.strictEqual(client.selectedDb, undefined, 'default db should be undefined');
|
||||
client.select(9999, function (err) {
|
||||
assert.equal(err.code, 'ERR');
|
||||
assert.equal(err.message, 'ERR invalid DB index');
|
||||
@@ -82,10 +82,10 @@ describe("The 'select' method", function () {
|
||||
describe('and no callback is specified', function () {
|
||||
describe('with a valid db index', function () {
|
||||
it('selects the appropriate database', function (done) {
|
||||
assert.strictEqual(client.selected_db, undefined, 'default db should be undefined');
|
||||
assert.strictEqual(client.selectedDb, undefined, 'default db should be undefined');
|
||||
client.select(1);
|
||||
setTimeout(function () {
|
||||
assert.equal(client.selected_db, 1, 'we should have selected the new valid DB');
|
||||
assert.equal(client.selectedDb, 1, 'we should have selected the new valid DB');
|
||||
done();
|
||||
}, 25);
|
||||
});
|
||||
@@ -93,7 +93,7 @@ describe("The 'select' method", function () {
|
||||
|
||||
describe('with an invalid db index', function () {
|
||||
it('emits an error when callback not provided', function (done) {
|
||||
assert.strictEqual(client.selected_db, undefined, 'default db should be undefined');
|
||||
assert.strictEqual(client.selectedDb, undefined, 'default db should be undefined');
|
||||
|
||||
client.on('error', function (err) {
|
||||
assert.strictEqual(err.command, 'SELECT');
|
||||
@@ -108,14 +108,14 @@ describe("The 'select' method", function () {
|
||||
|
||||
describe('reconnection occurs', function () {
|
||||
it('selects the appropriate database after a reconnect', function (done) {
|
||||
assert.strictEqual(client.selected_db, undefined, 'default db should be undefined');
|
||||
assert.strictEqual(client.selectedDb, undefined, 'default db should be undefined');
|
||||
client.select(3);
|
||||
client.set('foo', 'bar', function () {
|
||||
client.stream.destroy();
|
||||
});
|
||||
client.once('ready', function () {
|
||||
assert.strictEqual(client.selected_db, 3);
|
||||
assert(typeof client.server_info.db3 === 'object');
|
||||
assert.strictEqual(client.selectedDb, 3);
|
||||
assert(typeof client.serverInfo.db3 === 'object');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@@ -39,9 +39,9 @@ describe("The 'srem' method", function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('allows multiple values to be removed with send_command', function (done) {
|
||||
client.send_command('sadd', ['set0', 'member0', 'member1', 'member2'], helper.isNumber(3));
|
||||
client.send_command('srem', ['set0', 'member1', 'member2'], helper.isNumber(2));
|
||||
it('allows multiple values to be removed with sendCommand', function (done) {
|
||||
client.sendCommand('sadd', ['set0', 'member0', 'member1', 'member2'], helper.isNumber(3));
|
||||
client.sendCommand('srem', ['set0', 'member1', 'member2'], helper.isNumber(2));
|
||||
client.smembers('set0', function (err, res) {
|
||||
assert.strictEqual(res.length, 1);
|
||||
assert.ok(~res.indexOf('member0'));
|
||||
|
@@ -28,7 +28,7 @@ describe("The 'zscan' method", function () {
|
||||
for (var i = 0; i < 500; i++) {
|
||||
hash['key_' + i] = 'value_' + i;
|
||||
set.push('member_' + i);
|
||||
zset.push(i, 'z_member_' + i);
|
||||
zset.push(i, 'zMember_' + i);
|
||||
}
|
||||
client.hmset('hash:1', hash);
|
||||
client.sadd('set:1', set);
|
||||
|
Reference in New Issue
Block a user