@@ -562,59 +562,59 @@ describe('RecommendationProvider', () => {
562
562
. calledWith ( jasmine . objectContaining ( { name : 'FT._LIST' } ) )
563
563
. mockResolvedValue ( mockFTListResponse_1 ) ;
564
564
565
- const redisServerRecommendation = await service
565
+ const redisSearchRecommendation = await service
566
566
. determineRediSearchRecommendation ( nodeClient , [ mockJSONKey ] ) ;
567
- expect ( redisServerRecommendation ) . toEqual ( { name : RECOMMENDATION_NAMES . REDIS_SEARCH } ) ;
567
+ expect ( redisSearchRecommendation ) . toEqual ( { name : RECOMMENDATION_NAMES . REDIS_SEARCH } ) ;
568
568
} ) ;
569
569
570
570
it ( 'should return rediSearch recommendation when there is huge string key' , async ( ) => {
571
571
when ( nodeClient . sendCommand )
572
572
. calledWith ( jasmine . objectContaining ( { name : 'FT._LIST' } ) )
573
573
. mockResolvedValue ( mockFTListResponse_1 ) ;
574
574
575
- const redisServerRecommendation = await service
575
+ const redisSearchRecommendation = await service
576
576
. determineRediSearchRecommendation ( nodeClient , [ mockRediSearchStringKey_1 ] ) ;
577
- expect ( redisServerRecommendation ) . toEqual ( { name : RECOMMENDATION_NAMES . REDIS_SEARCH } ) ;
577
+ expect ( redisSearchRecommendation ) . toEqual ( { name : RECOMMENDATION_NAMES . REDIS_SEARCH } ) ;
578
578
} ) ;
579
579
580
580
it ( 'should not return rediSearch recommendation when there is small string key' , async ( ) => {
581
581
when ( nodeClient . sendCommand )
582
582
. calledWith ( jasmine . objectContaining ( { name : 'FT._LIST' } ) )
583
583
. mockResolvedValue ( mockFTListResponse_1 ) ;
584
584
585
- const redisServerRecommendation = await service
585
+ const redisSearchRecommendation = await service
586
586
. determineRediSearchRecommendation ( nodeClient , [ mockRediSearchStringKey_2 ] ) ;
587
- expect ( redisServerRecommendation ) . toEqual ( null ) ;
587
+ expect ( redisSearchRecommendation ) . toEqual ( null ) ;
588
588
} ) ;
589
589
590
590
it ( 'should not return rediSearch recommendation when there are no indexes' , async ( ) => {
591
591
when ( nodeClient . sendCommand )
592
592
. calledWith ( jasmine . objectContaining ( { name : 'FT._LIST' } ) )
593
593
. mockResolvedValue ( mockFTListResponse_2 ) ;
594
594
595
- const redisServerRecommendation = await service
595
+ const redisSearchRecommendation = await service
596
596
. determineRediSearchRecommendation ( nodeClient , [ mockJSONKey ] ) ;
597
- expect ( redisServerRecommendation ) . toEqual ( null ) ;
597
+ expect ( redisSearchRecommendation ) . toEqual ( null ) ;
598
598
} ) ;
599
599
600
600
it ( 'should ignore errors when ft command execute with error' , async ( ) => {
601
601
when ( nodeClient . sendCommand )
602
602
. calledWith ( jasmine . objectContaining ( { name : 'FT._LIST' } ) )
603
603
. mockRejectedValue ( "some error" ) ;
604
604
605
- const redisServerRecommendation = await service
605
+ const redisSearchRecommendation = await service
606
606
. determineRediSearchRecommendation ( nodeClient , [ mockJSONKey ] ) ;
607
- expect ( redisServerRecommendation ) . toEqual ( { name : RECOMMENDATION_NAMES . REDIS_SEARCH } ) ;
607
+ expect ( redisSearchRecommendation ) . toEqual ( { name : RECOMMENDATION_NAMES . REDIS_SEARCH } ) ;
608
608
} ) ;
609
609
610
610
it ( 'should ignore errors when ft command execute with error' , async ( ) => {
611
611
when ( nodeClient . sendCommand )
612
612
. calledWith ( jasmine . objectContaining ( { name : 'FT._LIST' } ) )
613
613
. mockRejectedValue ( "some error" ) ;
614
614
615
- const redisServerRecommendation = await service
615
+ const redisSearchRecommendation = await service
616
616
. determineRediSearchRecommendation ( nodeClient , [ mockRediSearchStringKey_2 ] ) ;
617
- expect ( redisServerRecommendation ) . toEqual ( null ) ;
617
+ expect ( redisSearchRecommendation ) . toEqual ( null ) ;
618
618
} ) ;
619
619
} ) ;
620
620
@@ -624,19 +624,19 @@ describe('RecommendationProvider', () => {
624
624
. calledWith ( jasmine . objectContaining ( { name : 'info' } ) )
625
625
. mockResolvedValue ( mockRedisServerResponse_1 ) ;
626
626
627
- const redisServerRecommendation = await service
627
+ const redisVersionRecommendation = await service
628
628
. determineRedisVersionRecommendation ( nodeClient ) ;
629
- expect ( redisServerRecommendation ) . toEqual ( null ) ;
629
+ expect ( redisVersionRecommendation ) . toEqual ( null ) ;
630
630
} ) ;
631
631
632
632
it ( 'should return redis version recommendation' , async ( ) => {
633
633
when ( nodeClient . sendCommand )
634
634
. calledWith ( jasmine . objectContaining ( { name : 'info' } ) )
635
635
. mockResolvedValueOnce ( mockRedisServerResponse_2 ) ;
636
636
637
- const redisServerRecommendation = await service
637
+ const redisVersionRecommendation = await service
638
638
. determineRedisVersionRecommendation ( nodeClient ) ;
639
- expect ( redisServerRecommendation ) . toEqual ( { name : RECOMMENDATION_NAMES . REDIS_VERSION } ) ;
639
+ expect ( redisVersionRecommendation ) . toEqual ( { name : RECOMMENDATION_NAMES . REDIS_VERSION } ) ;
640
640
} ) ;
641
641
642
642
it ( 'should not return redis version recommendation when info command executed with error' ,
@@ -646,9 +646,23 @@ describe('RecommendationProvider', () => {
646
646
. calledWith ( jasmine . objectContaining ( { name : 'info' } ) )
647
647
. mockRejectedValue ( 'some error' ) ;
648
648
649
- const redisServerRecommendation = await service
649
+ const redisVersionRecommendation = await service
650
650
. determineRedisVersionRecommendation ( nodeClient ) ;
651
- expect ( redisServerRecommendation ) . toEqual ( null ) ;
651
+ expect ( redisVersionRecommendation ) . toEqual ( null ) ;
652
+ } ) ;
653
+ } ) ;
654
+
655
+ describe ( 'determineDangerousCommandsRecommendation' , ( ) => {
656
+ it ( 'should not return dangerous commands recommendation when "command" command executed with error' ,
657
+ async ( ) => {
658
+ resetAllWhenMocks ( ) ;
659
+ when ( nodeClient . sendCommand )
660
+ . calledWith ( jasmine . objectContaining ( { name : 'command' } ) )
661
+ . mockRejectedValue ( 'some error' ) ;
662
+
663
+ const dangerousCommandsRecommendation = await service
664
+ . determineDangerousCommandsRecommendation ( nodeClient ) ;
665
+ expect ( dangerousCommandsRecommendation ) . toEqual ( null ) ;
652
666
} ) ;
653
667
} ) ;
654
668
} ) ;
0 commit comments