@@ -42,7 +42,7 @@ describe('CliAnalyticsService', () => {
42
42
43
43
describe ( 'sendCliClientCreatedEvent' , ( ) => {
44
44
it ( 'should emit CliClientCreated event' , ( ) => {
45
- service . sendClientCreatedEvent ( instanceId , 'cli' , { data : 'Some data' } ) ;
45
+ service . sendClientCreatedEvent ( instanceId , AppTool . CLI , { data : 'Some data' } ) ;
46
46
47
47
expect ( sendEventMethod ) . toHaveBeenCalledWith (
48
48
`CLI_${ TelemetryEvents . ClientCreated } ` ,
@@ -66,7 +66,7 @@ describe('CliAnalyticsService', () => {
66
66
67
67
describe ( 'sendCliClientCreationFailedEvent' , ( ) => {
68
68
it ( 'should emit CliClientCreationFailed event' , ( ) => {
69
- service . sendClientCreationFailedEvent ( instanceId , 'cli' , httpException , { data : 'Some data' } ) ;
69
+ service . sendClientCreationFailedEvent ( instanceId , AppTool . CLI , httpException , { data : 'Some data' } ) ;
70
70
71
71
expect ( sendFailedEventMethod ) . toHaveBeenCalledWith (
72
72
`CLI_${ TelemetryEvents . ClientCreationFailed } ` ,
@@ -78,7 +78,7 @@ describe('CliAnalyticsService', () => {
78
78
) ;
79
79
} ) ;
80
80
it ( 'should emit CliClientCreationFailed event without additional data' , ( ) => {
81
- service . sendClientCreationFailedEvent ( instanceId , 'cli' , httpException ) ;
81
+ service . sendClientCreationFailedEvent ( instanceId , AppTool . CLI , httpException ) ;
82
82
83
83
expect ( sendFailedEventMethod ) . toHaveBeenCalledWith (
84
84
`CLI_${ TelemetryEvents . ClientCreationFailed } ` ,
@@ -92,7 +92,7 @@ describe('CliAnalyticsService', () => {
92
92
93
93
describe ( 'sendCliClientRecreatedEvent' , ( ) => {
94
94
it ( 'should emit CliClientRecreated event' , ( ) => {
95
- service . sendClientRecreatedEvent ( instanceId , 'cli' , { data : 'Some data' } ) ;
95
+ service . sendClientRecreatedEvent ( instanceId , AppTool . CLI , { data : 'Some data' } ) ;
96
96
97
97
expect ( sendEventMethod ) . toHaveBeenCalledWith (
98
98
`CLI_${ TelemetryEvents . ClientRecreated } ` ,
@@ -103,7 +103,7 @@ describe('CliAnalyticsService', () => {
103
103
) ;
104
104
} ) ;
105
105
it ( 'should emit CliClientRecreated event without additional data' , ( ) => {
106
- service . sendClientRecreatedEvent ( instanceId , 'cli' ) ;
106
+ service . sendClientRecreatedEvent ( instanceId , AppTool . CLI ) ;
107
107
108
108
expect ( sendEventMethod ) . toHaveBeenCalledWith (
109
109
`CLI_${ TelemetryEvents . ClientRecreated } ` ,
@@ -116,7 +116,7 @@ describe('CliAnalyticsService', () => {
116
116
117
117
describe ( 'sendCliClientDeletedEvent' , ( ) => {
118
118
it ( 'should emit CliClientDeleted event' , ( ) => {
119
- service . sendClientDeletedEvent ( 1 , instanceId , 'cli' , { data : 'Some data' } ) ;
119
+ service . sendClientDeletedEvent ( 1 , instanceId , AppTool . CLI , { data : 'Some data' } ) ;
120
120
121
121
expect ( sendEventMethod ) . toHaveBeenCalledWith (
122
122
`CLI_${ TelemetryEvents . ClientDeleted } ` ,
@@ -127,7 +127,7 @@ describe('CliAnalyticsService', () => {
127
127
) ;
128
128
} ) ;
129
129
it ( 'should emit CliClientDeleted event without additional data' , ( ) => {
130
- service . sendClientDeletedEvent ( 1 , instanceId , 'cli' ) ;
130
+ service . sendClientDeletedEvent ( 1 , instanceId , AppTool . CLI ) ;
131
131
132
132
expect ( sendEventMethod ) . toHaveBeenCalledWith (
133
133
`CLI_${ TelemetryEvents . ClientDeleted } ` ,
@@ -137,22 +137,22 @@ describe('CliAnalyticsService', () => {
137
137
) ;
138
138
} ) ;
139
139
it ( 'should not emit event' , ( ) => {
140
- service . sendClientDeletedEvent ( 0 , instanceId , 'cli' ) ;
140
+ service . sendClientDeletedEvent ( 0 , instanceId , AppTool . CLI ) ;
141
141
142
142
expect ( sendEventMethod ) . not . toHaveBeenCalled ( ) ;
143
143
} ) ;
144
144
it ( 'should not emit event on invalid input values' , ( ) => {
145
145
const input : any = { } ;
146
- service . sendClientDeletedEvent ( input , instanceId , 'cli' ) ;
146
+ service . sendClientDeletedEvent ( input , instanceId , AppTool . CLI ) ;
147
147
148
- expect ( ( ) => service . sendClientDeletedEvent ( input , instanceId , 'cli' ) ) . not . toThrow ( ) ;
148
+ expect ( ( ) => service . sendClientDeletedEvent ( input , instanceId , AppTool . CLI ) ) . not . toThrow ( ) ;
149
149
expect ( sendEventMethod ) . not . toHaveBeenCalled ( ) ;
150
150
} ) ;
151
151
} ) ;
152
152
153
153
describe ( 'sendCliCommandExecutedEvent' , ( ) => {
154
154
it ( 'should emit CliCommandExecuted event' , ( ) => {
155
- service . sendCommandExecutedEvent ( instanceId , 'cli' , { command : 'info' } ) ;
155
+ service . sendCommandExecutedEvent ( instanceId , AppTool . CLI , { command : 'info' } ) ;
156
156
157
157
expect ( sendEventMethod ) . toHaveBeenCalledWith (
158
158
`CLI_${ TelemetryEvents . CommandExecuted } ` ,
@@ -163,7 +163,7 @@ describe('CliAnalyticsService', () => {
163
163
) ;
164
164
} ) ;
165
165
it ( 'should emit CliCommandExecuted event without additional data' , ( ) => {
166
- service . sendCommandExecutedEvent ( instanceId , 'cli' ) ;
166
+ service . sendCommandExecutedEvent ( instanceId , AppTool . CLI ) ;
167
167
168
168
expect ( sendEventMethod ) . toHaveBeenCalledWith (
169
169
`CLI_${ TelemetryEvents . CommandExecuted } ` ,
@@ -208,7 +208,7 @@ describe('CliAnalyticsService', () => {
208
208
209
209
describe ( 'sendCliCommandErrorEvent' , ( ) => {
210
210
it ( 'should emit CliCommandError event' , ( ) => {
211
- service . sendCommandErrorEvent ( instanceId , 'cli' , redisReplyError , { data : 'Some data' } ) ;
211
+ service . sendCommandErrorEvent ( instanceId , AppTool . CLI , redisReplyError , { data : 'Some data' } ) ;
212
212
213
213
expect ( sendEventMethod ) . toHaveBeenCalledWith (
214
214
`CLI_${ TelemetryEvents . CommandErrorReceived } ` ,
@@ -221,7 +221,7 @@ describe('CliAnalyticsService', () => {
221
221
) ;
222
222
} ) ;
223
223
it ( 'should emit CliCommandError event without additional data' , ( ) => {
224
- service . sendCommandErrorEvent ( instanceId , 'cli' , redisReplyError ) ;
224
+ service . sendCommandErrorEvent ( instanceId , AppTool . CLI , redisReplyError ) ;
225
225
226
226
expect ( sendEventMethod ) . toHaveBeenCalledWith (
227
227
`CLI_${ TelemetryEvents . CommandErrorReceived } ` ,
@@ -234,7 +234,7 @@ describe('CliAnalyticsService', () => {
234
234
} ) ;
235
235
it ( 'should emit event for custom error' , ( ) => {
236
236
const error : any = CliParsingError ;
237
- service . sendCommandErrorEvent ( instanceId , 'cli' , error ) ;
237
+ service . sendCommandErrorEvent ( instanceId , AppTool . CLI , error ) ;
238
238
239
239
expect ( sendEventMethod ) . toHaveBeenCalledWith (
240
240
`CLI_${ TelemetryEvents . CommandErrorReceived } ` ,
@@ -248,7 +248,7 @@ describe('CliAnalyticsService', () => {
248
248
249
249
describe ( 'sendCliClientCreationFailedEvent' , ( ) => {
250
250
it ( 'should emit CliConnectionError event' , ( ) => {
251
- service . sendConnectionErrorEvent ( instanceId , 'cli' , httpException , { data : 'Some data' } ) ;
251
+ service . sendConnectionErrorEvent ( instanceId , AppTool . CLI , httpException , { data : 'Some data' } ) ;
252
252
253
253
expect ( sendFailedEventMethod ) . toHaveBeenCalledWith (
254
254
`CLI_${ TelemetryEvents . ClientConnectionError } ` ,
@@ -260,7 +260,7 @@ describe('CliAnalyticsService', () => {
260
260
) ;
261
261
} ) ;
262
262
it ( 'should emit CliConnectionError event without additional data' , ( ) => {
263
- service . sendConnectionErrorEvent ( instanceId , 'cli' , httpException ) ;
263
+ service . sendConnectionErrorEvent ( instanceId , AppTool . CLI , httpException ) ;
264
264
265
265
expect ( sendFailedEventMethod ) . toHaveBeenCalledWith (
266
266
`CLI_${ TelemetryEvents . ClientConnectionError } ` ,
@@ -281,7 +281,7 @@ describe('CliAnalyticsService', () => {
281
281
status : CommandExecutionStatus . Success ,
282
282
} ;
283
283
284
- service . sendClusterCommandExecutedEvent ( instanceId , 'cli' , nodExecResult , { command : 'sadd' } ) ;
284
+ service . sendClusterCommandExecutedEvent ( instanceId , AppTool . CLI , nodExecResult , { command : 'sadd' } ) ;
285
285
286
286
expect ( sendEventMethod ) . toHaveBeenCalledWith (
287
287
`CLI_${ TelemetryEvents . ClusterNodeCommandExecuted } ` ,
@@ -300,7 +300,7 @@ describe('CliAnalyticsService', () => {
300
300
status : CommandExecutionStatus . Fail ,
301
301
} ;
302
302
303
- service . sendClusterCommandExecutedEvent ( instanceId , 'cli' , nodExecResult ) ;
303
+ service . sendClusterCommandExecutedEvent ( instanceId , AppTool . CLI , nodExecResult ) ;
304
304
305
305
expect ( sendEventMethod ) . toHaveBeenCalledWith (
306
306
`CLI_${ TelemetryEvents . CommandErrorReceived } ` ,
@@ -320,7 +320,7 @@ describe('CliAnalyticsService', () => {
320
320
status : CommandExecutionStatus . Fail ,
321
321
} ;
322
322
323
- service . sendClusterCommandExecutedEvent ( instanceId , 'cli' , nodExecResult ) ;
323
+ service . sendClusterCommandExecutedEvent ( instanceId , AppTool . CLI , nodExecResult ) ;
324
324
325
325
expect ( sendEventMethod ) . toHaveBeenCalledWith (
326
326
`CLI_${ TelemetryEvents . CommandErrorReceived } ` ,
@@ -337,7 +337,7 @@ describe('CliAnalyticsService', () => {
337
337
port : 7002 ,
338
338
status : 'undefined status' ,
339
339
} ;
340
- service . sendClusterCommandExecutedEvent ( instanceId , 'cli' , nodExecResult ) ;
340
+ service . sendClusterCommandExecutedEvent ( instanceId , AppTool . CLI , nodExecResult ) ;
341
341
342
342
expect ( sendEventMethod ) . not . toHaveBeenCalled ( ) ;
343
343
} ) ;
0 commit comments