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

Commit 5822bcb

Browse files
alanshawdaviddias
authored andcommitted
test: Fixes timeout ms arg being erroneously passed to pubsub.peers (#196)
* fixes timeout ms arg being erroneously passed to pubsub.peers * fixes typo in spec docs
1 parent 3192a48 commit 5822bcb

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

SPEC/PUBSUB.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pubsub API
1212
- `topic: string`
1313
- `options: Object` - (Optional), might contain the following properties:
1414
- `discover`: type: Boolean - Will use the DHT to find other peers.
15-
- `handler: (msg) => ()` - Event handler which will be called with a message object everytime one is received. The `msg` has the format `{from: string, seqno: Buffer, data: Buffer, topicCIDs: Array<string>}`.
15+
- `handler: (msg) => ()` - Event handler which will be called with a message object everytime one is received. The `msg` has the format `{from: string, seqno: Buffer, data: Buffer, topicIDs: Array<string>}`.
1616
- `callback: (Error) => ()` (Optional) Called once the subscription is established.
1717

1818
If no `callback` is passed, a [promise][] is returned.

src/pubsub.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,15 @@ module.exports = (common) => {
298298
(cb) => ipfs3.pubsub.subscribe(topicOther, sub3, cb)
299299
], (err) => {
300300
expect(err).to.not.exist()
301-
setTimeout(() => {
302-
ipfs1.pubsub.peers(topic, (err, peers) => {
303-
expect(err).to.not.exist()
304301

305-
expect(peers).to.be.empty()
306-
ipfs1.pubsub.unsubscribe(topic, sub1)
307-
ipfs2.pubsub.unsubscribe(topicOther, sub2)
308-
ipfs3.pubsub.unsubscribe(topicOther, sub3)
309-
done()
310-
}, 10000)
302+
ipfs1.pubsub.peers(topic, (err, peers) => {
303+
expect(err).to.not.exist()
304+
305+
expect(peers).to.be.empty()
306+
ipfs1.pubsub.unsubscribe(topic, sub1)
307+
ipfs2.pubsub.unsubscribe(topicOther, sub2)
308+
ipfs3.pubsub.unsubscribe(topicOther, sub3)
309+
done()
311310
})
312311
})
313312
})

0 commit comments

Comments
 (0)