Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit 8b890b6

Browse files
vasco-santosAlan Shaw
authored and
Alan Shaw
committed
fix: dht find peer (#418)
1 parent ddbc329 commit 8b890b6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

js/src/dht/findpeer.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ const { spawnNodesWithId } = require('../utils/spawn')
55
const { getDescribe, getIt, expect } = require('../utils/mocha')
66
const { connect } = require('../utils/swarm')
77

8-
const checkAll = (bits) => string => bits.every(bit => string.includes(bit))
9-
108
module.exports = (createCommon, options) => {
119
const describe = getDescribe(options)
1210
const it = getIt(options)
@@ -48,10 +46,11 @@ module.exports = (createCommon, options) => {
4846
expect(err).to.not.exist()
4947

5048
const id = res.id.toB58String()
51-
const addrs = res.multiaddrs.toArray().map((ma) => ma.toString())
49+
const nodeAddresses = nodeB.peerId.addresses.map((addr) => addr.split('/ipfs/')[0]) // remove '/ipfs/'
50+
const peerAddresses = res.multiaddrs.toArray().map((ma) => ma.toString().split('/ipfs/')[0])
5251

5352
expect(id).to.be.eql(nodeB.peerId.id)
54-
expect(nodeB.peerId.addresses[0]).to.satisfy(checkAll([addrs[0]]))
53+
expect(nodeAddresses).to.include(peerAddresses[0])
5554
done()
5655
})
5756
})

0 commit comments

Comments
 (0)