-
Notifications
You must be signed in to change notification settings - Fork 108
refactor: return peer ids as strings #581
Changes from all commits
5e839ef
1760949
9147ee6
5dd360b
9a00b4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,14 +27,15 @@ module.exports = (common, options) => { | |
after(() => common.clean()) | ||
|
||
it('should find other peers', async () => { | ||
const res = await nodeA.dht.findPeer(nodeB.peerId.id) | ||
|
||
const nodeBId = await nodeB.id() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not part of the API defined in This is my mind wandering from the task in hand though so I'm happy to change it if required. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, so it shouldn't be used in the interface tests because we can't guarantee There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
const res = await nodeA.dht.findPeer(nodeBId.id) | ||
const id = res.id.toString() | ||
const nodeAddresses = nodeB.peerId.addresses.map((addr) => addr.split('/ipfs/')[0]) // remove '/ipfs/' | ||
const peerAddresses = res.addrs.map(ma => ma.toString().split('/ipfs/')[0]) | ||
|
||
const nodeAddresses = nodeBId.addresses.map((addr) => addr.nodeAddress()) | ||
const peerAddresses = res.addrs.map(ma => ma.nodeAddress()) | ||
|
||
expect(id).to.be.eql(nodeB.peerId.id) | ||
expect(nodeAddresses).to.include(peerAddresses[0]) | ||
expect(peerAddresses).to.deep.include(nodeAddresses[0]) | ||
}) | ||
|
||
it('should fail to find other peer if peer does not exist', () => { | ||
|
Uh oh!
There was an error while loading. Please reload this page.