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

chore: use standard

This commit is contained in:
Ruben Bridgewater
2017-05-06 07:06:52 +02:00
parent 5d29f541e9
commit f1a7bcd735
106 changed files with 10706 additions and 10978 deletions

View File

@@ -1,117 +1,115 @@
'use strict';
'use strict'
var assert = require('assert');
var config = require('../lib/config');
var helper = require('../helper');
var redis = config.redis;
var assert = require('assert')
var config = require('../lib/config')
var helper = require('../helper')
var redis = config.redis
describe("The 'hmset' method", function () {
describe('The \'hmset\' method', function () {
helper.allTests(function (ip, args) {
describe('using ' + ip, function () {
var client
var hash = 'test hash'
helper.allTests(function (ip, args) {
beforeEach(function (done) {
client = redis.createClient.apply(null, args)
client.once('ready', function () {
client.flushdb(done)
})
})
describe('using ' + ip, function () {
var client;
var hash = 'test hash';
it('handles redis-style syntax', function (done) {
client.hmset(hash, '0123456789', 'abcdefghij', 'some manner of key', 'a type of value', 'otherTypes', 555, helper.isString('OK'))
client.hgetall(hash, function (err, obj) {
assert.strictEqual(obj['0123456789'], 'abcdefghij')
assert.strictEqual(obj['some manner of key'], 'a type of value')
return done(err)
})
})
beforeEach(function (done) {
client = redis.createClient.apply(null, args);
client.once('ready', function () {
client.flushdb(done);
});
});
it('handles object-style syntax', function (done) {
client.hmset(hash, {'0123456789': 'abcdefghij', 'some manner of key': 'a type of value', 'otherTypes': 555}, helper.isString('OK'))
client.hgetall(hash, function (err, obj) {
assert.strictEqual(obj['0123456789'], 'abcdefghij')
assert.strictEqual(obj['some manner of key'], 'a type of value')
return done(err)
})
})
it('handles redis-style syntax', function (done) {
client.hmset(hash, '0123456789', 'abcdefghij', 'some manner of key', 'a type of value', 'otherTypes', 555, helper.isString('OK'));
client.hgetall(hash, function (err, obj) {
assert.equal(obj['0123456789'], 'abcdefghij');
assert.equal(obj['some manner of key'], 'a type of value');
return done(err);
});
});
it('handles object-style syntax and the key being a number', function (done) {
client.hmset(231232, {'0123456789': 'abcdefghij', 'some manner of key': 'a type of value', 'otherTypes': 555}, undefined)
client.hgetall(231232, function (err, obj) {
assert.strictEqual(obj['0123456789'], 'abcdefghij')
assert.strictEqual(obj['some manner of key'], 'a type of value')
return done(err)
})
})
it('handles object-style syntax', function (done) {
client.hmset(hash, {'0123456789': 'abcdefghij', 'some manner of key': 'a type of value', 'otherTypes': 555}, helper.isString('OK'));
client.hgetall(hash, function (err, obj) {
assert.equal(obj['0123456789'], 'abcdefghij');
assert.equal(obj['some manner of key'], 'a type of value');
return done(err);
});
});
it('allows a numeric key', function (done) {
client.hmset(hash, 99, 'banana', helper.isString('OK'))
client.hgetall(hash, function (err, obj) {
assert.strictEqual(obj['99'], 'banana')
return done(err)
})
})
it('handles object-style syntax and the key being a number', function (done) {
client.hmset(231232, {'0123456789': 'abcdefghij', 'some manner of key': 'a type of value', 'otherTypes': 555}, undefined);
client.hgetall(231232, function (err, obj) {
assert.equal(obj['0123456789'], 'abcdefghij');
assert.equal(obj['some manner of key'], 'a type of value');
return done(err);
});
});
it('allows a numeric key without callback', function (done) {
client.hmset(hash, 99, 'banana', 'test', 25)
client.hgetall(hash, function (err, obj) {
assert.strictEqual(obj['99'], 'banana')
assert.strictEqual(obj.test, '25')
return done(err)
})
})
it('allows a numeric key', function (done) {
client.hmset(hash, 99, 'banana', helper.isString('OK'));
client.hgetall(hash, function (err, obj) {
assert.equal(obj['99'], 'banana');
return done(err);
});
});
it('allows an array without callback', function (done) {
client.hmset([hash, 99, 'banana', 'test', 25])
client.hgetall(hash, function (err, obj) {
assert.strictEqual(obj['99'], 'banana')
assert.strictEqual(obj.test, '25')
return done(err)
})
})
it('allows a numeric key without callback', function (done) {
client.hmset(hash, 99, 'banana', 'test', 25);
client.hgetall(hash, function (err, obj) {
assert.equal(obj['99'], 'banana');
assert.equal(obj.test, '25');
return done(err);
});
});
it('allows an array and a callback', function (done) {
client.hmset([hash, 99, 'banana', 'test', 25], helper.isString('OK'))
client.hgetall(hash, function (err, obj) {
assert.strictEqual(obj['99'], 'banana')
assert.strictEqual(obj.test, '25')
return done(err)
})
})
it('allows an array without callback', function (done) {
client.hmset([hash, 99, 'banana', 'test', 25]);
client.hgetall(hash, function (err, obj) {
assert.equal(obj['99'], 'banana');
assert.equal(obj.test, '25');
return done(err);
});
});
it('allows a key plus array without callback', function (done) {
client.hmset(hash, [99, 'banana', 'test', 25])
client.hgetall(hash, function (err, obj) {
assert.strictEqual(obj['99'], 'banana')
assert.strictEqual(obj.test, '25')
return done(err)
})
})
it('allows an array and a callback', function (done) {
client.hmset([hash, 99, 'banana', 'test', 25], helper.isString('OK'));
client.hgetall(hash, function (err, obj) {
assert.equal(obj['99'], 'banana');
assert.equal(obj.test, '25');
return done(err);
});
});
it('allows a key plus array and a callback', function (done) {
client.hmset(hash, [99, 'banana', 'test', 25], helper.isString('OK'))
client.hgetall(hash, function (err, obj) {
assert.strictEqual(obj['99'], 'banana')
assert.strictEqual(obj.test, '25')
return done(err)
})
})
it('allows a key plus array without callback', function (done) {
client.hmset(hash, [99, 'banana', 'test', 25]);
client.hgetall(hash, function (err, obj) {
assert.equal(obj['99'], 'banana');
assert.equal(obj.test, '25');
return done(err);
});
});
it('handles object-style syntax without callback', function (done) {
client.hmset(hash, {'0123456789': 'abcdefghij', 'some manner of key': 'a type of value'})
client.hgetall(hash, function (err, obj) {
assert.strictEqual(obj['0123456789'], 'abcdefghij')
assert.strictEqual(obj['some manner of key'], 'a type of value')
return done(err)
})
})
it('allows a key plus array and a callback', function (done) {
client.hmset(hash, [99, 'banana', 'test', 25], helper.isString('OK'));
client.hgetall(hash, function (err, obj) {
assert.equal(obj['99'], 'banana');
assert.equal(obj.test, '25');
return done(err);
});
});
it('handles object-style syntax without callback', function (done) {
client.hmset(hash, {'0123456789': 'abcdefghij', 'some manner of key': 'a type of value'});
client.hgetall(hash, function (err, obj) {
assert.equal(obj['0123456789'], 'abcdefghij');
assert.equal(obj['some manner of key'], 'a type of value');
return done(err);
});
});
afterEach(function () {
client.end(true);
});
});
});
});
afterEach(function () {
client.end(true)
})
})
})
})