1
1
import {
2
- getTCP4Endpoints ,
2
+ getTCPEndpoints ,
3
3
} from 'src/utils/auto-discovery-helper' ;
4
4
5
5
const winNetstat = ''
@@ -12,6 +12,7 @@ const winNetstat = ''
12
12
+ 'TCP [::]:445 [::]:0 LISTENING 4\n'
13
13
+ 'TCP [::]:808 [::]:0 LISTENING 6084\n'
14
14
+ 'TCP [::]:2701 [::]:0 LISTENING 6056\n'
15
+ + 'TCP [::]:5000 [::]:0 LISTENING 6056\n'
15
16
+ 'TCP *:* LISTENING 6056' ;
16
17
17
18
const linuxNetstat = ''
@@ -39,14 +40,18 @@ const macNetstat = ''
39
40
+ 'tcp6 0 0 ::1.52167 ::1.5002 ESTABLISHED 406172 146808 31200 0 0x0102 0x00000008\n' ;
40
41
/* eslint-enable max-len */
41
42
42
- const getTCP4EndpointsTests = [
43
+ const getTCPEndpointsTests = [
43
44
{
44
45
name : 'win output' ,
45
46
input : winNetstat . split ( '\n' ) ,
46
47
output : [
47
48
{ host : 'localhost' , port : 5000 } ,
48
49
{ host : 'localhost' , port : 6379 } ,
49
50
{ host : 'localhost' , port : 6380 } ,
51
+ { host : 'localhost' , port : 135 } ,
52
+ { host : 'localhost' , port : 445 } ,
53
+ { host : 'localhost' , port : 808 } ,
54
+ { host : 'localhost' , port : 2701 } ,
50
55
] ,
51
56
} ,
52
57
{
@@ -56,6 +61,12 @@ const getTCP4EndpointsTests = [
56
61
{ host : 'localhost' , port : 5000 } ,
57
62
{ host : 'localhost' , port : 6379 } ,
58
63
{ host : 'localhost' , port : 6380 } ,
64
+ { host : 'localhost' , port : 28100 } ,
65
+ { host : 'localhost' , port : 8100 } ,
66
+ { host : 'localhost' , port : 8101 } ,
67
+ { host : 'localhost' , port : 8102 } ,
68
+ { host : 'localhost' , port : 8103 } ,
69
+ { host : 'localhost' , port : 8200 } ,
59
70
] ,
60
71
} ,
61
72
{
@@ -65,14 +76,16 @@ const getTCP4EndpointsTests = [
65
76
{ host : 'localhost' , port : 5000 } ,
66
77
{ host : 'localhost' , port : 6379 } ,
67
78
{ host : 'localhost' , port : 6380 } ,
79
+ { host : 'localhost' , port : 5002 } ,
80
+ { host : 'localhost' , port : 52167 } ,
68
81
] ,
69
82
} ,
70
83
] ;
71
84
72
85
describe ( 'getTCP4Endpoints' , ( ) => {
73
- getTCP4EndpointsTests . forEach ( ( test ) => {
86
+ getTCPEndpointsTests . forEach ( ( test ) => {
74
87
it ( `Should return endpoints to test ${ test . name } ` , async ( ) => {
75
- const result = getTCP4Endpoints ( test . input ) ;
88
+ const result = getTCPEndpoints ( test . input ) ;
76
89
77
90
expect ( result ) . toEqual ( test . output ) ;
78
91
} ) ;
0 commit comments