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

Commit

Permalink
fix: dht find peer (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos authored and alanshaw committed Dec 14, 2018
1 parent ddbc329 commit 8b890b6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions js/src/dht/findpeer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ const { spawnNodesWithId } = require('../utils/spawn')
const { getDescribe, getIt, expect } = require('../utils/mocha')
const { connect } = require('../utils/swarm')

const checkAll = (bits) => string => bits.every(bit => string.includes(bit))

module.exports = (createCommon, options) => {
const describe = getDescribe(options)
const it = getIt(options)
Expand Down Expand Up @@ -48,10 +46,11 @@ module.exports = (createCommon, options) => {
expect(err).to.not.exist()

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

expect(id).to.be.eql(nodeB.peerId.id)
expect(nodeB.peerId.addresses[0]).to.satisfy(checkAll([addrs[0]]))
expect(nodeAddresses).to.include(peerAddresses[0])
done()
})
})
Expand Down

0 comments on commit 8b890b6

Please sign in to comment.