@@ -55,7 +55,7 @@ function makeCheck (n, done) {
55
55
}
56
56
57
57
module . exports = ( common ) => {
58
- describe . only ( '.pubsub' , ( ) => {
58
+ describe ( '.pubsub' , ( ) => {
59
59
const topic = 'pubsub-tests'
60
60
61
61
describe ( 'callback API' , ( ) => {
@@ -303,17 +303,24 @@ module.exports = (common) => {
303
303
} )
304
304
305
305
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
+ } ]
310
316
311
317
each ( topics , ( t , cb ) => {
312
318
ipfs1 . pubsub . subscribe ( t . name , t . handler , cb )
313
319
} , ( err ) => {
314
320
expect ( err ) . to . not . exist
315
321
ipfs1 . pubsub . ls ( ( err , list ) => {
316
322
expect ( err ) . to . not . exist
323
+
317
324
expect (
318
325
list . sort ( )
319
326
) . to . be . eql (
@@ -322,7 +329,6 @@ module.exports = (common) => {
322
329
323
330
topics . forEach ( ( t ) => {
324
331
ipfs1 . pubsub . unsubscribe ( t . name , t . handler )
325
- ipfs2 . pubsub . unsubscribe ( t . name , t . handler )
326
332
} )
327
333
328
334
done ( )
@@ -531,18 +537,14 @@ module.exports = (common) => {
531
537
common . teardown ( done )
532
538
} )
533
539
534
- it ( '.subscribe and .publish' , ( done ) => {
535
- const check = makeCheck ( 2 , done )
536
-
540
+ it ( '.subscribe and .publish' , ( ) => {
537
541
const sub = ( msg ) => {
538
542
expect ( msg . data . toString ( ) ) . to . be . eql ( 'hi' )
539
543
ipfs1 . pubsub . unsubscribe ( topic , sub )
540
- check ( )
541
544
}
542
545
543
- ipfs1 . pubsub . subscribe ( topic , sub )
546
+ return ipfs1 . pubsub . subscribe ( topic , sub )
544
547
. then ( ( ) => ipfs1 . pubsub . publish ( topic , 'hi' ) )
545
- . then ( check , check )
546
548
} )
547
549
548
550
it ( '.peers' , ( ) => {
0 commit comments