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

Commit

Permalink
fix: pubsub subscribe call with options
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
  • Loading branch information
alanshaw committed May 9, 2018
1 parent 4c13425 commit c43f8bc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions js/src/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ module.exports = (common) => {
expect(msg).to.have.property('topicIDs').eql([topic])
expect(msg).to.have.property('from', ipfs1.peerId.id)

ipfs1.pubsub.unsubscribe(topic, handler, () => {
ipfs1.pubsub.unsubscribe(topic, handler, (err) => {
expect(err).to.not.exist()

ipfs1.pubsub.ls((err, topics) => {
expect(err).to.not.exist()
expect(topics).to.be.empty()
Expand All @@ -164,7 +166,9 @@ module.exports = (common) => {
expect(msg).to.have.property('topicIDs').eql([topic])
expect(msg).to.have.property('from', ipfs1.peerId.id)

ipfs1.pubsub.unsubscribe(topic, handler, () => {
ipfs1.pubsub.unsubscribe(topic, handler, (err) => {
expect(err).to.not.exist()

ipfs1.pubsub.ls((err, topics) => {
expect(err).to.not.exist()
expect(topics).to.be.empty()
Expand All @@ -190,7 +194,9 @@ module.exports = (common) => {
expect(msg).to.have.property('topicIDs').eql([topic])
expect(msg).to.have.property('from', ipfs1.peerId.id)

ipfs1.pubsub.unsubscribe(topic, handler, () => {
ipfs1.pubsub.unsubscribe(topic, handler, (err) => {
expect(err).to.not.exist()

ipfs1.pubsub.ls((err, topics) => {
expect(err).to.not.exist()
expect(topics).to.be.empty()
Expand Down Expand Up @@ -251,9 +257,7 @@ module.exports = (common) => {
ipfs1.pubsub.unsubscribe(topic, handler, check)
}

ipfs1.pubsub.subscribe(topic, {
discover: true
}, handler, (err) => {
ipfs1.pubsub.subscribe(topic, handler, { discover: true }, (err) => {
expect(err).to.not.exist()
ipfs1.pubsub.publish(topic, Buffer.from('hi'), check)
})
Expand Down

0 comments on commit c43f8bc

Please sign in to comment.