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

Commit c43f8bc

Browse files
committed
fix: pubsub subscribe call with options
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
1 parent 4c13425 commit c43f8bc

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Diff for: js/src/pubsub.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ module.exports = (common) => {
138138
expect(msg).to.have.property('topicIDs').eql([topic])
139139
expect(msg).to.have.property('from', ipfs1.peerId.id)
140140

141-
ipfs1.pubsub.unsubscribe(topic, handler, () => {
141+
ipfs1.pubsub.unsubscribe(topic, handler, (err) => {
142+
expect(err).to.not.exist()
143+
142144
ipfs1.pubsub.ls((err, topics) => {
143145
expect(err).to.not.exist()
144146
expect(topics).to.be.empty()
@@ -164,7 +166,9 @@ module.exports = (common) => {
164166
expect(msg).to.have.property('topicIDs').eql([topic])
165167
expect(msg).to.have.property('from', ipfs1.peerId.id)
166168

167-
ipfs1.pubsub.unsubscribe(topic, handler, () => {
169+
ipfs1.pubsub.unsubscribe(topic, handler, (err) => {
170+
expect(err).to.not.exist()
171+
168172
ipfs1.pubsub.ls((err, topics) => {
169173
expect(err).to.not.exist()
170174
expect(topics).to.be.empty()
@@ -190,7 +194,9 @@ module.exports = (common) => {
190194
expect(msg).to.have.property('topicIDs').eql([topic])
191195
expect(msg).to.have.property('from', ipfs1.peerId.id)
192196

193-
ipfs1.pubsub.unsubscribe(topic, handler, () => {
197+
ipfs1.pubsub.unsubscribe(topic, handler, (err) => {
198+
expect(err).to.not.exist()
199+
194200
ipfs1.pubsub.ls((err, topics) => {
195201
expect(err).to.not.exist()
196202
expect(topics).to.be.empty()
@@ -251,9 +257,7 @@ module.exports = (common) => {
251257
ipfs1.pubsub.unsubscribe(topic, handler, check)
252258
}
253259

254-
ipfs1.pubsub.subscribe(topic, {
255-
discover: true
256-
}, handler, (err) => {
260+
ipfs1.pubsub.subscribe(topic, handler, { discover: true }, (err) => {
257261
expect(err).to.not.exist()
258262
ipfs1.pubsub.publish(topic, Buffer.from('hi'), check)
259263
})

0 commit comments

Comments
 (0)