From f1b1666accce73e0520120726cfc11daeb6492cc Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Fri, 14 Dec 2018 16:11:41 +0000 Subject: [PATCH] fix: dht find peer --- js/src/dht/findpeer.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js/src/dht/findpeer.js b/js/src/dht/findpeer.js index 980a26890..028ebb155 100644 --- a/js/src/dht/findpeer.js +++ b/js/src/dht/findpeer.js @@ -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) @@ -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() }) })