Skip to content

Commit 6f00ff8

Browse files
Add a test for binary client hgetall binary keys
1 parent b1d8ff9 commit 6f00ff8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,21 @@ tests.HGETALL = function () {
14031403
});
14041404
};
14051405

1406+
tests.HGETALL_2 = function () {
1407+
var name = "HGETALL (Binary client)";
1408+
bclient.hmset(["bhosts", "mjr", "1", "another", "23", "home", "1234", new Buffer([0xAA, 0xBB, 0x00, 0xF0]), new Buffer([0xCC, 0xDD, 0x00, 0xF0])], require_string("OK", name));
1409+
bclient.HGETALL(["bhosts"], function (err, obj) {
1410+
assert.strictEqual(null, err, name + " result sent back unexpected error: " + err);
1411+
assert.strictEqual(4, Object.keys(obj).length, name);
1412+
assert.strictEqual("1", obj.mjr.toString(), name);
1413+
assert.strictEqual("23", obj.another.toString(), name);
1414+
assert.strictEqual("1234", obj.home.toString(), name);
1415+
assert.strictEqual((new Buffer([0xAA, 0xBB, 0x00, 0xF0])).toString('binary'), Object.keys(obj)[3], name);
1416+
assert.strictEqual((new Buffer([0xCC, 0xDD, 0x00, 0xF0])).toString('binary'), obj[(new Buffer([0xAA, 0xBB, 0x00, 0xF0])).toString('binary')].toString('binary'), name);
1417+
next(name);
1418+
});
1419+
};
1420+
14061421
tests.HGETALL_MESSAGE = function () {
14071422
var name = "HGETALL_MESSAGE";
14081423
client.hmset("msg_test", {message: "hello"}, require_string("OK", name));

0 commit comments

Comments
 (0)