@@ -15,6 +15,10 @@ describe("tls option", () => {
15
15
// @ts -ignore
16
16
expect ( op . ca ) . to . eql ( "123" ) ;
17
17
// @ts -ignore
18
+ expect ( op . servername ) . to . eql ( "localhost" ) ;
19
+ // @ts -ignore
20
+ expect ( op . rejectUnauthorized ) . to . eql ( false ) ;
21
+ // @ts -ignore
18
22
expect ( op . port ) . to . eql ( 6379 ) ;
19
23
const stream = net . createConnection ( op ) ;
20
24
stream . on ( "connect" , ( data ) => {
@@ -23,7 +27,9 @@ describe("tls option", () => {
23
27
return stream ;
24
28
} ) ;
25
29
26
- redis = new Redis ( { tls : { ca : "123" } } ) ;
30
+ redis = new Redis ( {
31
+ tls : { ca : "123" , servername : "localhost" , rejectUnauthorized : false } ,
32
+ } ) ;
27
33
redis . on ( "ready" , ( ) => {
28
34
redis . disconnect ( ) ;
29
35
stub . restore ( ) ;
@@ -68,6 +74,10 @@ describe("tls option", () => {
68
74
const stub = sinon . stub ( tls , "connect" ) . callsFake ( ( op ) => {
69
75
// @ts -ignore
70
76
expect ( op . ca ) . to . eql ( "123" ) ;
77
+ // @ts -ignore
78
+ expect ( op . servername ) . to . eql ( "localhost" ) ;
79
+ // @ts -ignore
80
+ expect ( op . rejectUnauthorized ) . to . eql ( false ) ;
71
81
redis . disconnect ( ) ;
72
82
stub . restore ( ) ;
73
83
process . nextTick ( done ) ;
@@ -77,7 +87,7 @@ describe("tls option", () => {
77
87
redis = new Redis ( {
78
88
sentinels : [ { port : 27379 } ] ,
79
89
name : "my" ,
80
- tls : { ca : "123" } ,
90
+ tls : { ca : "123" , servername : "localhost" , rejectUnauthorized : false } ,
81
91
enableTLSForSentinelMode : true ,
82
92
} ) ;
83
93
} ) ;
@@ -96,6 +106,10 @@ describe("tls option", () => {
96
106
// @ts -ignore
97
107
expect ( op . ca ) . to . eql ( "123" ) ;
98
108
// @ts -ignore
109
+ expect ( op . servername ) . to . eql ( "localhost" ) ;
110
+ // @ts -ignore
111
+ expect ( op . rejectUnauthorized ) . to . eql ( false ) ;
112
+ // @ts -ignore
99
113
expect ( op . port ) . to . eql ( 27379 ) ;
100
114
const stream = net . createConnection ( op ) ;
101
115
stream . on ( "connect" , ( data ) => {
@@ -107,7 +121,11 @@ describe("tls option", () => {
107
121
redis = new Redis ( {
108
122
sentinels : [ { port : 27379 } ] ,
109
123
name : "my" ,
110
- sentinelTLS : { ca : "123" } ,
124
+ sentinelTLS : {
125
+ ca : "123" ,
126
+ servername : "localhost" ,
127
+ rejectUnauthorized : false ,
128
+ } ,
111
129
} ) ;
112
130
redis . on ( "ready" , ( ) => {
113
131
redis . disconnect ( ) ;
0 commit comments