Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated to use the external bisection module.
Added test cases, updated documentation.
- Loading branch information
Showing
6 changed files
with
51 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
doc: | ||
dox --title "node-hashring" lib/* > doc/index.html | ||
|
||
.PHONY: doc | ||
test: | ||
expresso -I lib $(TESTFLAGS) tests/*.test.js | ||
|
||
.PHONY: test doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
var should = require('should') | ||
, hashring = require('../lib/hashring'); | ||
|
||
module.exports = { | ||
'Library version': function(){ | ||
hashring.version.should.match(/^\d+\.\d+\.\d+$/); | ||
} | ||
|
||
, 'Constructing with a string': function(){ | ||
var ring = new hashring('192.168.0.102:11212'); | ||
|
||
ring.nodes.should.have.length(1); | ||
ring.sortedKeys.length.should.be.above(1); | ||
Object.keys(ring.weights).should.have.length(0); | ||
} | ||
|
||
, 'Constructing with a array': function(){ | ||
var ring = new hashring(['192.168.0.102:11212', '192.168.0.103:11212', '192.168.0.104:11212']); | ||
|
||
ring.nodes.should.have.length(3); | ||
ring.sortedKeys.length.should.be.above(1); | ||
Object.keys(ring.weights).should.have.length(0); | ||
} | ||
|
||
, 'Constructing with a object': function(){ | ||
var ring = new hashring({'192.168.0.102:11212': 1, '192.168.0.103:11212': 2, '192.168.0.104:11212': 1}); | ||
|
||
ring.nodes.should.have.length(3); | ||
ring.sortedKeys.length.should.be.above(1); | ||
Object.keys(ring.weights).should.have.length(3); | ||
} | ||
|
||
, 'Constructing with a different algorithm': function(){ | ||
var ring = new hashring('192.168.0.102:11212', 'md5'); | ||
|
||
ring.nodes.should.have.length(1); | ||
ring.algorithm.should.equal('md5'); | ||
ring.sortedKeys.length.should.be.above(1); | ||
Object.keys(ring.weights).should.have.length(0); | ||
} | ||
}; |