@@ -10,17 +10,30 @@ describe('StandaloneConnector', function () {
10
10
stub ( net , 'createConnection' ) ;
11
11
var connector = new StandaloneConnector ( { port : 6379 , path : '/tmp' } ) ;
12
12
connector . connect ( function ( ) {
13
- net . createConnection . calledWith ( { path : '/tmp' } ) ;
13
+ expect ( net . createConnection . calledOnce ) . to . eql ( true ) ;
14
+ expect ( net . createConnection . firstCall . args [ 0 ] ) . to . eql ( { path : '/tmp' } ) ;
15
+ net . createConnection . restore ( ) ;
16
+ done ( ) ;
17
+ } ) ;
18
+ } ) ;
19
+
20
+ it ( 'ignore path when port is set and path is null' , function ( done ) {
21
+ stub ( net , 'createConnection' ) ;
22
+ var connector = new StandaloneConnector ( { port : 6379 , path : null } ) ;
23
+ connector . connect ( function ( ) {
24
+ expect ( net . createConnection . calledOnce ) . to . eql ( true ) ;
25
+ expect ( net . createConnection . firstCall . args [ 0 ] ) . to . eql ( { port : 6379 } ) ;
14
26
net . createConnection . restore ( ) ;
15
27
done ( ) ;
16
28
} ) ;
17
29
} ) ;
18
30
19
31
it ( 'supports tls' , function ( done ) {
20
32
stub ( tls , 'connect' ) ;
21
- var connector = new StandaloneConnector ( { port : 6379 , tls : 'on' } ) ;
33
+ var connector = new StandaloneConnector ( { port : 6379 , tls : { ca : 'on' } } ) ;
22
34
connector . connect ( function ( ) {
23
- tls . connect . calledWith ( { port : 6379 , tls : 'on' } ) ;
35
+ expect ( tls . connect . calledOnce ) . to . eql ( true ) ;
36
+ expect ( tls . connect . firstCall . args [ 0 ] ) . to . eql ( { port : 6379 , ca : 'on' } ) ;
24
37
tls . connect . restore ( ) ;
25
38
done ( ) ;
26
39
} ) ;
0 commit comments