1
1
import { parseRedisUrl } from 'uiSrc/utils/parseRedisUrl'
2
2
3
3
const defaultRedisParams = {
4
+ protocol : 'redis' ,
4
5
username : '' ,
5
6
password : '' ,
6
7
port : undefined ,
@@ -20,29 +21,37 @@ const parseRedisUrlTests: Array<[string, any]> = [
20
21
'redis://us@er:pass@localhost:6380' ,
21
22
null
22
23
] ,
24
+ [
25
+ 'localhost' ,
26
+ null
27
+ ] ,
28
+ [
29
+ 'localhost:6379' ,
30
+ { ...defaultRedisParams , host : 'localhost' , port : 6379 }
31
+ ] ,
23
32
[
24
33
'redis://localhost' ,
25
- { ...defaultRedisParams , protocol : 'redis' , host : 'localhost' }
34
+ { ...defaultRedisParams , host : 'localhost' }
26
35
] ,
27
36
[
28
37
'redis://localhost:6380' ,
29
- { ...defaultRedisParams , protocol : 'redis' , host : 'localhost' , port : 6380 }
38
+ { ...defaultRedisParams , host : 'localhost' , port : 6380 }
30
39
] ,
31
40
[
32
41
'redis://@localhost:6380' ,
33
- { ...defaultRedisParams , protocol : 'redis' , host : 'localhost' , port : 6380 }
42
+ { ...defaultRedisParams , host : 'localhost' , port : 6380 }
34
43
] ,
35
44
[
36
45
'redis://user@localhost:6380' ,
37
- { ...defaultRedisParams , username : 'user' , protocol : 'redis' , host : 'localhost' , port : 6380 }
46
+ { ...defaultRedisParams , username : 'user' , host : 'localhost' , port : 6380 }
38
47
] ,
39
48
[
40
49
'redis://:pass@localhost:6380' ,
41
- { ...defaultRedisParams , protocol : 'redis' , password : 'pass' , host : 'localhost' , port : 6380 }
50
+ { ...defaultRedisParams , password : 'pass' , host : 'localhost' , port : 6380 }
42
51
] ,
43
52
[
44
53
'redis://user:pass@localhost:6380' ,
45
- { ...defaultRedisParams , protocol : 'redis' , username : 'user' , password : 'pass' , host : 'localhost' , port : 6380 }
54
+ { ...defaultRedisParams , username : 'user' , password : 'pass' , host : 'localhost' , port : 6380 }
46
55
] ,
47
56
[
48
57
'rediss://user:pa%712ss@localhost:6380' ,
0 commit comments