@@ -115,9 +115,7 @@ describe("client authentication", function () {
115
115
auth_pass : auth
116
116
} ) ;
117
117
client = redis . createClient . apply ( null , args ) ;
118
- client . on ( "ready" , function ( ) {
119
- return done ( ) ;
120
- } ) ;
118
+ client . on ( "ready" , done ) ;
121
119
} ) ;
122
120
123
121
it ( 'allows auth and no_ready_check to be provided as config option for client' , function ( done ) {
@@ -128,9 +126,7 @@ describe("client authentication", function () {
128
126
no_ready_check : true
129
127
} ) ;
130
128
client = redis . createClient . apply ( null , args ) ;
131
- client . on ( "ready" , function ( ) {
132
- done ( ) ;
133
- } ) ;
129
+ client . on ( "ready" , done ) ;
134
130
} ) ;
135
131
136
132
it ( 'allows auth to be provided post-hoc with auth method' , function ( done ) {
@@ -139,25 +135,24 @@ describe("client authentication", function () {
139
135
var args = config . configureClient ( parser , ip ) ;
140
136
client = redis . createClient . apply ( null , args ) ;
141
137
client . auth ( auth ) ;
142
- client . on ( "ready" , function ( ) {
143
- return done ( ) ;
144
- } ) ;
138
+ client . on ( "ready" , done ) ;
145
139
} ) ;
146
140
147
141
it ( 'reconnects with appropriate authentication' , function ( done ) {
148
142
if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
149
143
150
- var readyCount = 0 ;
151
144
client = redis . createClient . apply ( null , args ) ;
152
145
client . auth ( auth ) ;
153
146
client . on ( "ready" , function ( ) {
154
- readyCount ++ ;
155
- if ( readyCount === 1 ) {
147
+ if ( this . times_connected === 1 ) {
156
148
client . stream . destroy ( ) ;
157
149
} else {
158
- return done ( ) ;
150
+ done ( ) ;
159
151
}
160
152
} ) ;
153
+ client . on ( 'reconnecting' , function ( params ) {
154
+ assert . strictEqual ( params . error . message , 'Stream connection closed' ) ;
155
+ } ) ;
161
156
} ) ;
162
157
163
158
it ( 'should return an error if the password is not of type string and a callback has been provided' , function ( done ) {
0 commit comments