Skip to content

Commit

Permalink
feat(cluster): support binary keys
Browse files Browse the repository at this point in the history
Close #637
  • Loading branch information
luin committed Jul 19, 2019
1 parent 9a113ca commit b414ed9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"author": "luin <i@zihua.li> (http://zihua.li)",
"license": "MIT",
"dependencies": {
"cluster-key-slot": "^1.0.6",
"cluster-key-slot": "^1.1.0",
"debug": "^4.1.1",
"denque": "^1.1.0",
"lodash.defaults": "^4.2.0",
Expand Down
10 changes: 7 additions & 3 deletions test/unit/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ describe("Command", function() {
});

describe("#getSlot()", function() {
function expectSlot(key: any, slot: number) {
expect(new Command("get", [key]).getSlot()).to.eql(slot);
}

it("should return correctly", function() {
expectSlot("123", 5970);
expectSlot(123, 5970);
Expand All @@ -144,10 +148,10 @@ describe("Command", function() {
expectSlot("", 0);
expectSlot(null, 0);
expectSlot(undefined, 0);
});

function expectSlot(key, slot) {
expect(new Command("get", [key]).getSlot()).to.eql(slot);
}
it("supports buffers", () => {
expectSlot(Buffer.from("encoding"), 3060);
});
});

Expand Down

0 comments on commit b414ed9

Please sign in to comment.