@@ -13,7 +13,7 @@ import {
13
13
mockCliClientMetadata ,
14
14
mockDatabaseClientFactory ,
15
15
mockStandaloneRedisClient ,
16
- mockClusterRedisClient ,
16
+ mockClusterRedisClient , mockRedisFtInfoReply , mockFtInfoAnalyticsData ,
17
17
} from 'src/__mocks__' ;
18
18
import {
19
19
CommandExecutionStatus ,
@@ -232,6 +232,34 @@ describe('CliBusinessService', () => {
232
232
} ) ;
233
233
234
234
describe ( 'sendCommand' , ( ) => {
235
+ it ( 'should successfully execute ft.info command' , async ( ) => {
236
+ const dto : SendCommandDto = { command : 'ft.info idx' } ;
237
+ const formatSpy = jest . spyOn ( rawFormatter , 'format' ) ;
238
+ const mockResult : SendCommandResponse = {
239
+ response : mockRedisFtInfoReply ,
240
+ status : CommandExecutionStatus . Success ,
241
+ } ;
242
+ when ( standaloneClient . sendCommand )
243
+ . calledWith ( [ 'ft.info' , 'idx' ] , expect . anything ( ) )
244
+ . mockReturnValue ( mockRedisFtInfoReply ) ;
245
+
246
+ const result = await service . sendCommand ( mockCliClientMetadata , dto ) ;
247
+
248
+ expect ( result ) . toEqual ( mockResult ) ;
249
+ expect ( formatSpy ) . toHaveBeenCalled ( ) ;
250
+ expect ( analyticsService . sendCommandExecutedEvent ) . toHaveBeenCalledWith (
251
+ mockCliClientMetadata . databaseId ,
252
+ {
253
+ command : 'ft.info' ,
254
+ outputFormat : CliOutputFormatterTypes . Raw ,
255
+ } ,
256
+ ) ;
257
+ expect ( analyticsService . sendIndexInfoEvent ) . toHaveBeenCalledWith (
258
+ mockCliClientMetadata . databaseId ,
259
+ mockFtInfoAnalyticsData ,
260
+ ) ;
261
+ } ) ;
262
+
235
263
it ( 'should successfully execute command (RAW format)' , async ( ) => {
236
264
const dto : SendCommandDto = { command : mockMemoryUsageCommand } ;
237
265
const formatSpy = jest . spyOn ( rawFormatter , 'format' ) ;
0 commit comments