From 905c9119466c11f3e68097df68505aa3e7cb247c Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Fri, 12 Jul 2019 14:02:03 +0200 Subject: [PATCH] fix: peer routing for delegate router (#377) * fix: peer routing tests * test: fix mock payload type Provider results are type 4, not type 1: https://github.com/libp2p/go-libp2p-core/blob/6e566d10f4a5447317a66d64c7459954b969bdab/routing/query.go#L15-L24 --- src/peer-routing.js | 2 +- test/content-routing.node.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/peer-routing.js b/src/peer-routing.js index b69787a8..998c8023 100644 --- a/src/peer-routing.js +++ b/src/peer-routing.js @@ -47,7 +47,7 @@ module.exports = (node) => { }) tryEach(tasks, (err, results) => { - if (err && err.code !== 'NOT_FOUND') { + if (err) { return callback(err) } results = results || [] diff --git a/test/content-routing.node.js b/test/content-routing.node.js index d015690c..9c7eecde 100644 --- a/test/content-routing.node.js +++ b/test/content-routing.node.js @@ -251,7 +251,7 @@ describe('.contentRouting', () => { timeout: '1000ms', 'stream-channels': true }) - .reply(200, `{"Extra":"","ID":"QmWKqWXCtRXEeCQTo3FoZ7g4AfnGiauYYiczvNxFCHicbB","Responses":[{"Addrs":["/ip4/0.0.0.0/tcp/0"],"ID":"${provider}"}],"Type":1}\n`, [ + .reply(200, `{"Extra":"","ID":"QmWKqWXCtRXEeCQTo3FoZ7g4AfnGiauYYiczvNxFCHicbB","Responses":[{"Addrs":["/ip4/0.0.0.0/tcp/0"],"ID":"${provider}"}],"Type":4}\n`, [ 'Content-Type', 'application/json', 'X-Chunked-Output', '1' ])