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

Add support for camelCase

Fixes missing `EXEC_BATCH` on multi
This commit is contained in:
Ruben Bridgewater
2016-04-13 03:54:19 +02:00
parent dfd493f6ee
commit d2b8f2f391
11 changed files with 154 additions and 34 deletions

View File

@@ -11,7 +11,7 @@ describe('utils.js', function () {
it('ignore the object prototype and clone a nested array / object', function () {
var obj = {
a: [null, 'foo', ['bar'], {
"I'm special": true
"i'm special": true
}],
number: 5,
fn: function noop () {}
@@ -22,13 +22,28 @@ describe('utils.js', function () {
assert(typeof clone.fn === 'function');
});
it('replace faulty values with an empty object as return value', function () {
it('replace falsy values with an empty object as return value', function () {
var a = utils.clone();
var b = utils.clone(null);
assert.strictEqual(Object.keys(a).length, 0);
assert.strictEqual(Object.keys(b).length, 0);
});
it('transform camelCase options to snack_case and add the camel_case option', function () {
var a = utils.clone({
optionOneTwo: true,
retryStrategy: false,
nested: {
onlyContainCamelCaseOnce: true
}
});
assert.strictEqual(Object.keys(a).length, 4);
assert.strictEqual(a.option_one_two, true);
assert.strictEqual(a.retry_strategy, false);
assert.strictEqual(a.camel_case, true);
assert.strictEqual(Object.keys(a.nested).length, 1);
});
it('throws on circular data', function () {
try {
var a = {};