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

Improve code coverage by adding tests and removing unnecessary code

This commit is contained in:
Ruben Bridgewater
2015-09-03 21:54:57 +02:00
parent b1e51c8c7b
commit 89e1f6f067
10 changed files with 166 additions and 95 deletions

View File

@@ -20,7 +20,7 @@ describe("The 'hmset' method", function () {
});
it('handles redis-style syntax', function (done) {
client.HMSET(hash, "0123456789", "abcdefghij", "some manner of key", "a type of value", helper.isString('OK'));
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');
@@ -29,7 +29,7 @@ describe("The 'hmset' method", function () {
});
it('handles object-style syntax', function (done) {
client.HMSET(hash, {"0123456789": "abcdefghij", "some manner of key": "a type of value"}, helper.isString('OK'));
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');
@@ -37,6 +37,15 @@ describe("The 'hmset' method", function () {
})
});
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}, helper.isString('OK'));
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', function (done) {
client.HMSET(hash, 99, 'banana', helper.isString('OK'));
client.HGETALL(hash, function (err, obj) {