Merge pull request #386 from manan19/peer-tests

adding few tests for Peer.js
This commit is contained in:
Manuel Aráoz 2014-06-19 10:31:29 -03:00
commit d7f31bf785
1 changed files with 22 additions and 0 deletions

View File

@ -20,6 +20,28 @@ describe('Peer', function() {
var p = new Peer('localhost', 8333);
should.exist(p);
});
it('should be able to create instance', function() {
var p = new Peer('localhost:8333');
should.exist(p);
});
it('should be able to create instance', function() {
var p = new Peer('localhost:8333');
var p2 = new Peer(p);
should.exist(p2);
});
it('should not be able to create instance', function() {
should.throw(function() {
new Peer(8333);
});
});
it('should be able to create instance', function() {
var p = new Peer('localhost', 8333);
p.toString().should.equal('localhost:8333');
});
it('check host as buffer', function() {
var p = new Peer('127.0.0.1', 8333);
p.getHostAsBuffer().toString('hex').should.equal('7f000001');
});
});