File tree 1 file changed +14
-4
lines changed
1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -464,12 +464,22 @@ describe("pathToFsPath", () => {
464
464
it ( "should keep drive letter casing when set to true" , ( ) => {
465
465
expect ( util . pathToFsPath ( "/C:/far/bo" , true ) ) . toBe ( "C:/far/bo" )
466
466
} )
467
- it ( "should throw an error if an array is passed in for path" , ( ) => {
468
- // @ts -expect-error We need to make sure it throws when an array is passed in.
469
- expect ( ( ) => util . pathToFsPath ( [ ] ) ) . toThrow (
470
- `Could not computer fsPath from given uri. Expected path to be of type string, but was of type object.` ,
467
+ it ( "should throw an error if a non-string is passed in for path" , ( ) => {
468
+ expect ( ( ) =>
469
+ util
470
+ // @ts -expect-error We need to check other types
471
+ . pathToFsPath ( { } ) ,
472
+ ) . toThrow (
473
+ `Could not computer fsPath from given uri. Expected path to be of type string, but was of type undefined.` ,
471
474
)
472
475
} )
476
+ it ( "should not throw an error for a string array" , ( ) => {
477
+ // @ts -expect-error We need to check other types
478
+ expect ( ( ) => util . pathToFsPath ( [ "/hello/foo" , "/hello/bar" ] ) . not . toThrow ( ) )
479
+ } )
480
+ it ( "should use the first string in a string array" , ( ) => {
481
+ expect ( util . pathToFsPath ( [ "/hello/foo" , "/hello/bar" ] ) ) . toBe ( "/hello/foo" )
482
+ } )
473
483
it ( "should replace / with \\ on Windows" , ( ) => {
474
484
let ORIGINAL_PLATFORM = process . platform
475
485
You can’t perform that action at this time.
0 commit comments