chore: remove peer-info usage

BREAKING CHANGE: all API methods with peer-info parameters or return values were changed. You can check the API.md document, in order to check the new values to use
This commit is contained in:
Vasco Santos
2020-04-14 14:05:30 +02:00
committed by Jacob Heun
parent ed6d5bb4b4
commit 12e48adafa
45 changed files with 608 additions and 695 deletions

View File

@ -20,16 +20,19 @@ describe('ping', () => {
number: 2,
config: baseOptions
})
nodes[0].peerStore.addressBook.set(nodes[1].peerId, nodes[1].addresses.listen)
nodes[1].peerStore.addressBook.set(nodes[0].peerId, nodes[0].addresses.listen)
})
it('ping once from peer0 to peer1', async () => {
const latency = await nodes[0].ping(nodes[1].peerInfo)
const latency = await nodes[0].ping(nodes[1].peerId)
expect(latency).to.be.a('Number')
})
it('ping several times for getting an average', async () => {
const latencies = await pTimes(5, () => nodes[1].ping(nodes[0].peerInfo))
const latencies = await pTimes(5, () => nodes[1].ping(nodes[0].peerId))
const averageLatency = latencies.reduce((p, c) => p + c, 0) / latencies.length
expect(averageLatency).to.be.a('Number')
@ -66,7 +69,7 @@ describe('ping', () => {
)
})
const latency = await nodes[0].ping(nodes[1].peerInfo)
const latency = await nodes[0].ping(nodes[1].peerId)
expect(latency).to.be.a('Number')
})