@@ -13,6 +13,8 @@ import {
13
13
shouldOpenInExistingInstance ,
14
14
splitOnFirstEquals ,
15
15
toVsCodeArgs ,
16
+ optionDescriptions ,
17
+ options ,
16
18
} from "../../../src/node/cli"
17
19
import { shouldSpawnCliProcess } from "../../../src/node/main"
18
20
import { generatePassword , paths } from "../../../src/node/util"
@@ -753,3 +755,36 @@ describe("toVsCodeArgs", () => {
753
755
} )
754
756
} )
755
757
} )
758
+
759
+ describe ( "optionDescriptions" , ( ) => {
760
+ it ( "should return the descriptions of all the available options" , ( ) => {
761
+ const expectedOptionDescriptions = Object . entries ( options )
762
+ . flat ( )
763
+ . filter ( ( item : any ) => {
764
+ if ( item . description ) {
765
+ return item . description
766
+ }
767
+ } )
768
+ . map ( ( item : any ) => item . description )
769
+ const actualOptionDescriptions = optionDescriptions ( )
770
+ // We need both the expected and the actual
771
+ // Both of these are string[]
772
+ // We then loop through the expectedOptionDescriptions
773
+ // and check that this expectedDescription exists in the
774
+ // actualOptionDescriptions
775
+
776
+ // To do that we need to loop through actualOptionDescriptions
777
+ // and make sure we have a substring match
778
+ expectedOptionDescriptions . forEach ( ( expectedDescription ) => {
779
+ const exists = actualOptionDescriptions . find ( ( desc ) => {
780
+ if (
781
+ desc . replace ( / \n / g, " " ) . replace ( / / g, "" ) . includes ( expectedDescription . replace ( / \n / g, " " ) . replace ( / / g, "" ) )
782
+ ) {
783
+ return true
784
+ }
785
+ return false
786
+ } )
787
+ expect ( exists ) . toBeTruthy ( )
788
+ } )
789
+ } )
790
+ } )
0 commit comments