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

Commit 9319088

Browse files
last updates
1 parent 5416e38 commit 9319088

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/pubsub.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function makeCheck (n, done) {
5555
}
5656

5757
module.exports = (common) => {
58-
describe.only('.pubsub', () => {
58+
describe('.pubsub', () => {
5959
const topic = 'pubsub-tests'
6060

6161
describe('callback API', () => {
@@ -303,17 +303,24 @@ module.exports = (common) => {
303303
})
304304

305305
it('list with 3 subscribed topics', (done) => {
306-
const topics = ['one', 'two', 'three'].map((t) => ({
307-
name: t,
308-
handler (msg) {}
309-
}))
306+
const topics = [{
307+
name: 'one',
308+
handler () {}
309+
}, {
310+
name: 'two',
311+
handler () {}
312+
}, {
313+
name: 'three',
314+
handler () {}
315+
}]
310316

311317
each(topics, (t, cb) => {
312318
ipfs1.pubsub.subscribe(t.name, t.handler, cb)
313319
}, (err) => {
314320
expect(err).to.not.exist
315321
ipfs1.pubsub.ls((err, list) => {
316322
expect(err).to.not.exist
323+
317324
expect(
318325
list.sort()
319326
).to.be.eql(
@@ -322,7 +329,6 @@ module.exports = (common) => {
322329

323330
topics.forEach((t) => {
324331
ipfs1.pubsub.unsubscribe(t.name, t.handler)
325-
ipfs2.pubsub.unsubscribe(t.name, t.handler)
326332
})
327333

328334
done()
@@ -531,18 +537,14 @@ module.exports = (common) => {
531537
common.teardown(done)
532538
})
533539

534-
it('.subscribe and .publish', (done) => {
535-
const check = makeCheck(2, done)
536-
540+
it('.subscribe and .publish', () => {
537541
const sub = (msg) => {
538542
expect(msg.data.toString()).to.be.eql('hi')
539543
ipfs1.pubsub.unsubscribe(topic, sub)
540-
check()
541544
}
542545

543-
ipfs1.pubsub.subscribe(topic, sub)
546+
return ipfs1.pubsub.subscribe(topic, sub)
544547
.then(() => ipfs1.pubsub.publish(topic, 'hi'))
545-
.then(check, check)
546548
})
547549

548550
it('.peers', () => {

0 commit comments

Comments
 (0)