@@ -395,20 +395,38 @@ describe('connection tests', function () {
395395 } ) ;
396396 } ) ;
397397
398- it ( 'clears the socket timeout after a connection has been established' , function ( done ) {
398+ it ( 'clears connect_timeout on the socket timeout after a connection has been established' , function ( done ) {
399399 client = redis . createClient ( {
400400 parser : parser ,
401401 connect_timeout : 1000
402402 } ) ;
403403 process . nextTick ( function ( ) {
404404 assert . strictEqual ( client . stream . _idleTimeout , 1000 ) ;
405+
405406 } ) ;
406407 client . on ( 'connect' , function ( ) {
407408 assert . strictEqual ( client . stream . _idleTimeout , - 1 ) ;
408409 assert . strictEqual ( client . stream . listeners ( 'timeout' ) . length , 0 ) ;
409410 client . on ( 'ready' , done ) ;
410411 } ) ;
411412 } ) ;
413+
414+ it ( 'set the timeout to socket_timeout after a connection has been established' , function ( done ) {
415+ client = redis . createClient ( {
416+ parser : parser ,
417+ connect_timeout : 1000 ,
418+ socket_timeout : 2000
419+ } ) ;
420+ process . nextTick ( function ( ) {
421+ assert . strictEqual ( client . stream . _idleTimeout , 1000 ) ;
422+
423+ } ) ;
424+ client . on ( 'connect' , function ( ) {
425+ assert . strictEqual ( client . stream . _idleTimeout , 2000 ) ;
426+ assert . strictEqual ( client . stream . listeners ( 'timeout' ) . length , 1 ) ;
427+ client . on ( 'ready' , done ) ;
428+ } ) ;
429+ } ) ;
412430
413431 it ( 'connect with host and port provided in the options object' , function ( done ) {
414432 client = redis . createClient ( {
0 commit comments