feat: isPeerId

This commit is contained in:
David Dias
2017-03-27 13:23:18 +01:00
parent 8c49610dff
commit 0acc572fd3
2 changed files with 16 additions and 0 deletions

View File

@ -32,6 +32,16 @@ describe('PeerId', () => {
})
})
it('isPeerId', (done) => {
PeerId.create((err, id) => {
expect(err).to.not.exist()
expect(PeerId.isPeerId(id)).to.equal(true)
expect(PeerId.isPeerId('aaa')).to.equal(false)
expect(PeerId.isPeerId(new Buffer('batatas'))).to.equal(false)
done()
})
})
it('throws on changing the id', (done) => {
PeerId.create((err, id) => {
expect(err).to.not.exist()