@@ -84,27 +84,22 @@ describe("The node_redis client", function () {
84
84
} ) ;
85
85
} ) ;
86
86
87
+ // TODO: we should only have a single subscription in this this
88
+ // test but unsubscribing from the single channel indicates
89
+ // that one subscriber still exists, let's dig into this.
87
90
describe ( "and it's subscribed to a channel" , function ( ) {
88
91
// reconnect_select_db_after_pubsub
89
92
// Does not pass.
90
93
// "Connection in subscriber mode, only subscriber commands may be used"
91
- xit ( "reconnects, unsubscribes, and can retrieve the pre-existing data" , function ( done ) {
94
+ it ( "reconnects, unsubscribes, and can retrieve the pre-existing data" , function ( done ) {
92
95
client . on ( "reconnecting" , function on_recon ( params ) {
93
96
client . on ( "ready" , function on_connect ( ) {
94
- async . parallel ( [ function ( cb ) {
95
- client . unsubscribe ( "recon channel" , function ( err , res ) {
96
- helper . isNotError ( ) ( err , res ) ;
97
- cb ( ) ;
98
- } ) ;
99
- } , function ( cb ) {
100
- client . get ( "recon 1" , function ( err , res ) {
101
- helper . isString ( "one" ) ( err , res ) ;
102
- cb ( ) ;
103
- } ) ;
104
- } ] , function ( err , results ) {
105
- client . removeListener ( "connect" , on_connect ) ;
106
- client . removeListener ( "reconnecting" , on_recon ) ;
107
- done ( err ) ;
97
+ client . unsubscribe ( helper . isNotError ( ) ) ;
98
+
99
+ client . on ( 'unsubscribe' , function ( channel , count ) {
100
+ // we should now be out of subscriber mode.
101
+ client . set ( 'foo' , 'bar' , helper . isNumber ( 1 ) ) ;
102
+ return done ( ) ;
108
103
} ) ;
109
104
} ) ;
110
105
} ) ;
0 commit comments