@@ -477,19 +477,23 @@ describe("publish/subscribe", function () {
477
477
478
478
describe ( 'psubscribe' , function ( ) {
479
479
it ( 'allows all channels to be subscribed to using a * pattern' , function ( done ) {
480
- sub . end ( false ) ;
481
- sub = redis . createClient ( {
480
+ sub . subscribe ( '/foo' ) ;
481
+ var sub2 = redis . createClient ( {
482
482
return_buffers : true
483
483
} ) ;
484
- sub . on ( 'ready' , function ( ) {
485
- sub . psubscribe ( '*' ) ;
486
- sub . on ( "pmessage" , function ( pattern , channel , message ) {
484
+ sub2 . on ( 'ready' , function ( ) {
485
+ sub2 . psubscribe ( '*' ) ;
486
+ sub2 . subscribe ( '/foo' ) ;
487
+ sub2 . on ( "pmessage" , function ( pattern , channel , message ) {
487
488
assert . strictEqual ( pattern . inspect ( ) , new Buffer ( '*' ) . inspect ( ) ) ;
488
489
assert . strictEqual ( channel . inspect ( ) , new Buffer ( '/foo' ) . inspect ( ) ) ;
489
490
assert . strictEqual ( message . inspect ( ) , new Buffer ( 'hello world' ) . inspect ( ) ) ;
490
- done ( ) ;
491
+ sub2 . quit ( done ) ;
492
+ } ) ;
493
+ pub . pubsub ( 'numsub' , '/foo' , function ( err , res ) {
494
+ assert . deepEqual ( res , [ '/foo' , 2 ] ) ;
491
495
} ) ;
492
- pub . publish ( '/foo' , 'hello world' ) ;
496
+ pub . publish ( '/foo' , 'hello world' , helper . isNumber ( 3 ) ) ;
493
497
} ) ;
494
498
} ) ;
495
499
} ) ;
0 commit comments