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', () => {
6161} ) ;
6262
6363describe ( 'removeViewerPathname' , ( ) => {
64- test ( 'should remove pathname' , ( ) => {
64+ test ( 'should remove /viewer/json pathname' , ( ) => {
6565 const initialValue = 'https://ydb-testing-0000.search.net:8765/viewer/json' ;
6666 const result = 'https://ydb-testing-0000.search.net:8765' ;
6767
6868 expect ( removeViewerPathname ( initialValue ) ) . toBe ( result ) ;
6969 } ) ;
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+ } ) ;
7081} ) ;
7182describe ( 'removeProtocol' , ( ) => {
7283 test ( 'should remove protocol from start' , ( ) => {
Original file line number Diff line number Diff line change 11import { normalizePathSlashes } from '.' ;
22
33const 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 ) ? $ / ;
55
66export const removeViewerPathname = ( value : string ) => {
77 return value . replace ( viewerPathnameRegex , '' ) ;
You can’t perform that action at this time.
0 commit comments