forked from redis/node-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhlen.spec.js
38 lines (30 loc) · 1.11 KB
/
hlen.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
var config = require('../lib/config');
var helper = require('../helper');
var redis = config.redis;
describe("The 'hlen' method", function () {
helper.allTests(function (ip, args) {
describe('using ' + ip, function () {
var client;
beforeEach(function (done) {
client = redis.createClient.apply(null, args);
client.once('ready', function () {
client.flushdb(done);
});
});
it('reports the count of keys', function (done) {
var hash = 'test hash';
var field1 = new Buffer('0123456789');
var value1 = new Buffer('abcdefghij');
var field2 = new Buffer(0);
var value2 = new Buffer(0);
client.HSET(hash, field1, value1, helper.isNumber(1));
client.HSET(hash, field2, value2, helper.isNumber(1));
client.HLEN(hash, helper.isNumber(2, done));
});
afterEach(function () {
client.end(true);
});
});
});
});