@@ -16,6 +16,9 @@ describe('normalizePathSlashes', () => {
16
16
test ( 'should handle paths with multiple trailing slashes' , ( ) => {
17
17
expect ( normalizePathSlashes ( 'path////' ) ) . toBe ( 'path/' ) ;
18
18
} ) ;
19
+ test ( 'should handle paths with multiple leading slashes' , ( ) => {
20
+ expect ( normalizePathSlashes ( '////path' ) ) . toBe ( '/path' ) ;
21
+ } ) ;
19
22
test ( 'should handle full paths with normal slashes' , ( ) => {
20
23
expect ( normalizePathSlashes ( 'http://example.com/path/to/resource' ) ) . toBe (
21
24
'http://example.com/path/to/resource' ,
@@ -26,9 +29,14 @@ describe('normalizePathSlashes', () => {
26
29
'http://example.com/path/to/resource' ,
27
30
) ;
28
31
} ) ;
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
+ } ) ;
29
37
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' ) ;
33
41
} ) ;
34
42
} ) ;
0 commit comments