@@ -477,19 +477,23 @@ describe("publish/subscribe", function () {
477477
478478 describe ( 'psubscribe' , function ( ) {
479479 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 ( {
482482 return_buffers : true
483483 } ) ;
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 ) {
487488 assert . strictEqual ( pattern . inspect ( ) , new Buffer ( '*' ) . inspect ( ) ) ;
488489 assert . strictEqual ( channel . inspect ( ) , new Buffer ( '/foo' ) . inspect ( ) ) ;
489490 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 ] ) ;
491495 } ) ;
492- pub . publish ( '/foo' , 'hello world' ) ;
496+ pub . publish ( '/foo' , 'hello world' , helper . isNumber ( 3 ) ) ;
493497 } ) ;
494498 } ) ;
495499 } ) ;
0 commit comments