@@ -38,4 +38,73 @@ describe('Service list controller', () => {
38
38
} ,
39
39
} ) ) . toBe ( '#/service/foo-namespace/foo-service' ) ;
40
40
} ) ;
41
+
42
+ it ( 'should return true when service.clusterIP is null' , ( ) => {
43
+ expect ( ctrl . isPending ( {
44
+ clusterIP : null ,
45
+ } ) ) . toBeTruthy ( ) ;
46
+ } ) ;
47
+
48
+ it ( 'should return false when service.clusterIP is set' , ( ) => {
49
+ expect ( ctrl . isPending ( {
50
+ clusterIP : '10.67.252.103' ,
51
+ } ) ) . toBeFalsy ( ) ;
52
+ } ) ;
53
+
54
+ it ( 'should return true when service.type is LoadBalancer AND service.externalEndpoints is null' ,
55
+ ( ) => {
56
+ expect ( ctrl . isPending ( {
57
+ clusterIP : '10.67.252.103' ,
58
+ type : 'LoadBalancer' ,
59
+ externalEndpoints : null ,
60
+ } ) ) . toBeTruthy ( ) ;
61
+ } ) ;
62
+
63
+ it ( 'should return true when service.type is NodePort AND service.externalEndpoints is null' ,
64
+ ( ) => {
65
+ expect ( ctrl . isPending ( {
66
+ clusterIP : '10.67.252.103' ,
67
+ type : 'NodePort' ,
68
+ externalEndpoints : null ,
69
+ } ) ) . toBeTruthy ( ) ;
70
+ } ) ;
71
+
72
+ it ( 'should return true when service.type is LoadBalancer AND service.externalEndpoints is set' ,
73
+ ( ) => {
74
+ expect ( ctrl . isSuccess ( {
75
+ clusterIP : '10.67.252.103' ,
76
+ type : 'LoadBalancer' ,
77
+ externalEndpoints : [ '10.64.0.4:80' , '10.64.1.5:80' , '10.64.2.4:80' ] ,
78
+ } ) ) . toBeTruthy ( ) ;
79
+ } ) ;
80
+
81
+ it ( 'should return true when service.type is NodePort AND service.externalEndpoints is set' ,
82
+ ( ) => {
83
+ expect ( ctrl . isSuccess ( {
84
+ clusterIP : '10.67.252.103' ,
85
+ type : 'NodePort' ,
86
+ externalEndpoints : [ '10.64.0.4:80' , '10.64.1.5:80' , '10.64.2.4:80' ] ,
87
+ } ) ) . toBeTruthy ( ) ;
88
+ } ) ;
89
+
90
+ it ( 'should return true when service.type is ClusterIP and service.externalEndpoints is null' ,
91
+ ( ) => {
92
+ expect ( ctrl . isSuccess ( {
93
+ clusterIP : '10.67.252.103' ,
94
+ type : 'ClusterIP' ,
95
+ externalEndpoints : null ,
96
+ } ) ) . toBeTruthy ( ) ;
97
+ } ) ;
98
+
99
+ it ( 'should return the service clusterIP when teh clusterIP is set' , ( ) => {
100
+ expect ( ctrl . getServiceClusterIP ( {
101
+ clusterIP : '10.67.252.103' ,
102
+ } ) ) . toBe ( '10.67.252.103' ) ;
103
+ } ) ;
104
+
105
+ it ( 'should return the service clusterIP when teh clusterIP is set' , ( ) => {
106
+ expect ( ctrl . getServiceClusterIP ( {
107
+ clusterIP : null ,
108
+ } ) ) . toBe ( '-' ) ;
109
+ } ) ;
41
110
} ) ;
0 commit comments