Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: all pubsub tests passing with libp2p pubsub
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Feb 18, 2018
1 parent 6b9fc95 commit 6fe015f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/core/components/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,36 @@ module.exports = function pubsub (self) {

if (!callback) {
return new Promise((resolve, reject) => {
self.libp2p.pubsub.subscribe(topic, options, handler, (err) => {
self._libp2pNode.pubsub.subscribe(topic, options, handler, (err) => {
if (err) {
return reject(err)
}
resolve()
})
})
} else {
self.libp2p.pubsub.subscribe(topic, options, handler, callback)
self._libp2pNode.pubsub.subscribe(topic, options, handler, callback)
}
},

unsubscribe: (topic, handler) => {
self.libp2p.pubsub.unsubscribe(topic, handler)
self._libp2pNode.pubsub.unsubscribe(topic, handler)
},

publish: promisify((topic, data, callback) => {
self.libp2p.pubsub.publish(topic, data, callback)
self._libp2pNode.pubsub.publish(topic, data, callback)
}),

ls: promisify((callback) => {
self.libp2p.pubsub.ls(callback)
self._libp2pNode.pubsub.ls(callback)
}),

peers: promisify((topic, callback) => {
self.libp2p.pubsub.peers(topic, callback)
self._libp2pNode.pubsub.peers(topic, callback)
}),

setMaxListeners (n) {
self.libp2p.pubsub.setMaxListeners(n)
self._libp2pNode.pubsub.setMaxListeners(n)
}
}
}
4 changes: 2 additions & 2 deletions test/core/bitswap.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function addNode (inProcNode, callback) {
})
}

describe.only('bitswap', function () {
describe('bitswap', function () {
this.timeout(80 * 1000)

let inProcNode // Node spawned inside this process
Expand Down Expand Up @@ -136,7 +136,7 @@ describe.only('bitswap', function () {
})
})

describe.only('transfer a block between', () => {
describe('transfer a block between', () => {
it('2 peers', function (done) {
this.timeout(80 * 1000)

Expand Down

0 comments on commit 6fe015f

Please sign in to comment.