chore: deprecate old peer store api (#598)

* chore: deprecate old peer-store api

BREAKING CHANGE: the peer-store api changed. Check the API docs for the new specification.

* chore: apply suggestions from code review

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>

* chore: apply suggestions from code review

Co-Authored-By: Jacob Heun <jacobheun@gmail.com>

Co-authored-by: Jacob Heun <jacobheun@gmail.com>
This commit is contained in:
Vasco Santos
2020-04-16 15:20:42 +02:00
parent a08a725123
commit ac124644d5
10 changed files with 106 additions and 154 deletions

View File

@ -45,7 +45,7 @@ describe('peer-store', () => {
})
it('returns undefined on trying to find a non existant peerId', () => {
const peerInfo = peerStore.find(peerIds[0])
const peerInfo = peerStore.get(peerIds[0])
expect(peerInfo).to.not.exist()
})
})
@ -101,8 +101,8 @@ describe('peer-store', () => {
expect(peers.size).to.equal(3)
})
it('finds the stored information of a peer in all its books', () => {
const peerInfo = peerStore.find(peerIds[0])
it('gets the stored information of a peer in all its books', () => {
const peerInfo = peerStore.get(peerIds[0])
expect(peerInfo).to.exist()
expect(peerInfo.protocols).to.have.members([proto1])
@ -110,8 +110,8 @@ describe('peer-store', () => {
expect(peerMultiaddrs).to.have.members([addr1, addr2])
})
it('finds the stored information of a peer that is not present in all its books', () => {
const peerInfo = peerStore.find(peerIds[2])
it('gets the stored information of a peer that is not present in all its books', () => {
const peerInfo = peerStore.get(peerIds[2])
expect(peerInfo).to.exist()
expect(peerInfo.protocols.length).to.eql(0)