@@ -16,6 +16,9 @@ describe('normalizePathSlashes', () => {
1616 test ( 'should handle paths with multiple trailing slashes' , ( ) => {
1717 expect ( normalizePathSlashes ( 'path////' ) ) . toBe ( 'path/' ) ;
1818 } ) ;
19+ test ( 'should handle paths with multiple leading slashes' , ( ) => {
20+ expect ( normalizePathSlashes ( '////path' ) ) . toBe ( '/path' ) ;
21+ } ) ;
1922 test ( 'should handle full paths with normal slashes' , ( ) => {
2023 expect ( normalizePathSlashes ( 'http://example.com/path/to/resource' ) ) . toBe (
2124 'http://example.com/path/to/resource' ,
@@ -26,9 +29,14 @@ describe('normalizePathSlashes', () => {
2629 'http://example.com/path/to/resource' ,
2730 ) ;
2831 } ) ;
32+ test ( 'should not replace double slashes near protocols (after a colon)' , ( ) => {
33+ expect ( normalizePathSlashes ( 'http://host.ydb.com' ) ) . toBe ( 'http://host.ydb.com' ) ;
34+ expect ( normalizePathSlashes ( 'https://host.ydb.com' ) ) . toBe ( 'https://host.ydb.com' ) ;
35+ expect ( normalizePathSlashes ( 'grpc://host.ydb.com' ) ) . toBe ( 'grpc://host.ydb.com' ) ;
36+ } ) ;
2937 test ( 'should replace slashes more than two slashes after a colon' , ( ) => {
30- expect ( normalizePathSlashes ( 'http://///example. com/path/to/resource ' ) ) . toBe (
31- 'http ://example. com/path/to/resource' ,
32- ) ;
38+ expect ( normalizePathSlashes ( 'http:////host.ydb. com' ) ) . toBe ( 'http://host.ydb.com' ) ;
39+ expect ( normalizePathSlashes ( 'https ://///host.ydb. com' ) ) . toBe ( 'https://host.ydb.com' ) ;
40+ expect ( normalizePathSlashes ( 'grpc://///host.ydb.com' ) ) . toBe ( 'grpc://host.ydb.com' ) ;
3341 } ) ;
3442} ) ;
0 commit comments