File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -61,12 +61,23 @@ describe('parseBalancer', () => {
61
61
} ) ;
62
62
63
63
describe ( 'removeViewerPathname' , ( ) => {
64
- test ( 'should remove pathname' , ( ) => {
64
+ test ( 'should remove /viewer/json pathname' , ( ) => {
65
65
const initialValue = 'https://ydb-testing-0000.search.net:8765/viewer/json' ;
66
66
const result = 'https://ydb-testing-0000.search.net:8765' ;
67
67
68
68
expect ( removeViewerPathname ( initialValue ) ) . toBe ( result ) ;
69
69
} ) ;
70
+ test ( 'should remove /viewer pathname' , ( ) => {
71
+ const initialValue = 'https://ydb-testing-0000.search.net:8765/viewer' ;
72
+ const result = 'https://ydb-testing-0000.search.net:8765' ;
73
+
74
+ expect ( removeViewerPathname ( initialValue ) ) . toBe ( result ) ;
75
+ } ) ;
76
+ test ( 'should not change input if there is no /viewer or /viewer/json' , ( ) => {
77
+ const initialValue = 'https://ydb-testing-0000.search.net:8765' ;
78
+
79
+ expect ( removeViewerPathname ( initialValue ) ) . toBe ( initialValue ) ;
80
+ } ) ;
70
81
} ) ;
71
82
describe ( 'removeProtocol' , ( ) => {
72
83
test ( 'should remove protocol from start' , ( ) => {
Original file line number Diff line number Diff line change 1
1
import { normalizePathSlashes } from '.' ;
2
2
3
3
const protocolRegex = / ^ h t t p [ s ] ? : \/ \/ / ;
4
- const viewerPathnameRegex = / \/ v i e w e r \/ j s o n $ / ;
4
+ const viewerPathnameRegex = / \/ v i e w e r ( \/ j s o n ) ? $ / ;
5
5
6
6
export const removeViewerPathname = ( value : string ) => {
7
7
return value . replace ( viewerPathnameRegex , '' ) ;
You can’t perform that action at this time.
0 commit comments