Skip to content

Commit b414ed9

Browse files
committed
feat(cluster): support binary keys
Close #637
1 parent 9a113ca commit b414ed9

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"author": "luin <[email protected]> (http://zihua.li)",
3131
"license": "MIT",
3232
"dependencies": {
33-
"cluster-key-slot": "^1.0.6",
33+
"cluster-key-slot": "^1.1.0",
3434
"debug": "^4.1.1",
3535
"denque": "^1.1.0",
3636
"lodash.defaults": "^4.2.0",

test/unit/command.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ describe("Command", function() {
130130
});
131131

132132
describe("#getSlot()", function() {
133+
function expectSlot(key: any, slot: number) {
134+
expect(new Command("get", [key]).getSlot()).to.eql(slot);
135+
}
136+
133137
it("should return correctly", function() {
134138
expectSlot("123", 5970);
135139
expectSlot(123, 5970);
@@ -144,10 +148,10 @@ describe("Command", function() {
144148
expectSlot("", 0);
145149
expectSlot(null, 0);
146150
expectSlot(undefined, 0);
151+
});
147152

148-
function expectSlot(key, slot) {
149-
expect(new Command("get", [key]).getSlot()).to.eql(slot);
150-
}
153+
it("supports buffers", () => {
154+
expectSlot(Buffer.from("encoding"), 3060);
151155
});
152156
});
153157

0 commit comments

Comments
 (0)