@@ -34,7 +34,7 @@ describe("client authentication", function () {
34
34
} ) ;
35
35
} ) ;
36
36
37
- it ( "raises error when auth is bad" , function ( done ) {
37
+ it ( "emits error when auth is bad without callback " , function ( done ) {
38
38
if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
39
39
40
40
client = redis . createClient . apply ( redis . createClient , args ) ;
@@ -48,6 +48,18 @@ describe("client authentication", function () {
48
48
client . auth ( auth + 'bad' ) ;
49
49
} ) ;
50
50
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
+
51
63
if ( ip === 'IPv4' ) {
52
64
it ( 'allows auth to be provided as part of redis url' , function ( done ) {
53
65
if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
@@ -71,6 +83,19 @@ describe("client authentication", function () {
71
83
} ) ;
72
84
} ) ;
73
85
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
+
74
99
it ( 'allows auth to be provided post-hoc with auth method' , function ( done ) {
75
100
if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
76
101
0 commit comments