@@ -34,7 +34,7 @@ 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 ) ;
@@ -48,6 +48,18 @@ describe("client authentication", function () {
4848 client . auth ( auth + 'bad' ) ;
4949 } ) ;
5050
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+
5163 if ( ip === 'IPv4' ) {
5264 it ( 'allows auth to be provided as part of redis url' , function ( done ) {
5365 if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
@@ -71,6 +83,19 @@ describe("client authentication", function () {
7183 } ) ;
7284 } ) ;
7385
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+
7499 it ( 'allows auth to be provided post-hoc with auth method' , function ( done ) {
75100 if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
76101
0 commit comments