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

Commit f02aaea

Browse files
pubsub.peers: do not throw on missing subscription
1 parent 9319088 commit f02aaea

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/pubsub.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,21 @@ module.exports = (common) => {
192192
(cb) => ipfs1.swarm.connect(ipfs2.peerId.addresses[0], cb),
193193
(cb) => ipfs2.swarm.connect(ipfs3.peerId.addresses[0], cb),
194194
(cb) => ipfs1.swarm.connect(ipfs3.peerId.addresses[0], cb)
195-
], done)
195+
], (err) => {
196+
if (err) {
197+
return done(err)
198+
}
199+
// give some time to let everything connect
200+
setTimeout(done, 300)
201+
})
196202
})
197203

198204
describe('.peers', () => {
199-
it('returns an error when not subscribed to a topic', (done) => {
205+
it('does not error when not subscribed to a topic', (done) => {
200206
ipfs1.pubsub.peers(topic, (err, peers) => {
201-
expect(
202-
err.message
203-
).to.match(
204-
new RegExp(`Not subscribed to '${topic}'`)
205-
)
207+
expect(err).to.not.exist
208+
// Should be empty but as mentioned below go-ipfs returns more than it should
209+
// expect(peers).to.be.empty
206210

207211
done()
208212
})

0 commit comments

Comments
 (0)