@@ -34,19 +34,32 @@ describe("client authentication", function () {
3434 } ) ;
3535 } ) ;
3636
37- it ( "raises error when auth is bad" , function ( done ) {
37+ it ( "emits error when auth is bad without callback " , function ( done ) {
3838 if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
3939
4040 client = redis . createClient . apply ( redis . createClient , args ) ;
4141
42- client . once ( 'error' , function ( error ) {
43- assert . ok ( / E R R i n v a l i d p a s s w o r d / . test ( error ) ) ;
42+ client . once ( 'error' , function ( err ) {
43+ assert . strictEqual ( err . command_used , 'AUTH' ) ;
44+ assert . ok ( / E R R i n v a l i d p a s s w o r d / . test ( err . message ) ) ;
4445 return done ( ) ;
4546 } ) ;
4647
4748 client . auth ( auth + 'bad' ) ;
4849 } ) ;
4950
51+ it ( "returns an error when auth is bad with a callback" , function ( done ) {
52+ if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
53+
54+ client = redis . createClient . apply ( redis . createClient , args ) ;
55+
56+ client . auth ( auth + 'bad' , function ( err , res ) {
57+ assert . strictEqual ( err . command_used , 'AUTH' ) ;
58+ assert . ok ( / E R R i n v a l i d p a s s w o r d / . test ( err . message ) ) ;
59+ done ( ) ;
60+ } ) ;
61+ } ) ;
62+
5063 if ( ip === 'IPv4' ) {
5164 it ( 'allows auth to be provided as part of redis url' , function ( done ) {
5265 if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
@@ -70,6 +83,19 @@ describe("client authentication", function () {
7083 } ) ;
7184 } ) ;
7285
86+ it ( 'allows auth and no_ready_check to be provided as config option for client' , function ( done ) {
87+ if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
88+
89+ var args = config . configureClient ( parser , ip , {
90+ auth_pass : auth ,
91+ no_ready_check : true
92+ } ) ;
93+ client = redis . createClient . apply ( redis . createClient , args ) ;
94+ client . on ( "ready" , function ( ) {
95+ done ( ) ;
96+ } ) ;
97+ } ) ;
98+
7399 it ( 'allows auth to be provided post-hoc with auth method' , function ( done ) {
74100 if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
75101
0 commit comments