File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { PACKAGE_NAMES } from '../constants'
22import '../releases/__mocks__/index'
33import {
44 getVersionsContentInDiff ,
5+ removeAppPathPrefix ,
56 replaceAppDetails ,
67 getChangelogURL ,
78} from '../utils'
@@ -132,3 +133,21 @@ describe('replaceAppDetails ', () => {
132133 }
133134 )
134135} )
136+
137+ describe ( 'removeAppPathPrefix' , ( ) => {
138+ test . each ( [
139+ [ 'RnDiffApp/package.json' , 'package.json' ] ,
140+ [ 'RnDiffApp/RnDiffApp.ts' , 'RnDiffApp.ts' ] ,
141+ ] ) ( 'removeAppPathPrefix("%s") -> "%s"' , ( path , newPath ) => {
142+ expect ( removeAppPathPrefix ( path ) ) . toEqual ( newPath )
143+ } )
144+
145+ test ( 'removeAppPathPrefix custom AppName' , ( ) => {
146+ expect ( removeAppPathPrefix ( 'RnDiffApp/package.json' , '' ) ) . toEqual (
147+ 'RnDiffApp/package.json'
148+ )
149+ expect ( removeAppPathPrefix ( 'Foobar/package.json' , 'Foobar' ) ) . toEqual (
150+ 'package.json'
151+ )
152+ } )
153+ } )
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export const getBinaryFileURL = ({
7575}
7676
7777export const removeAppPathPrefix = ( path : string , appName = DEFAULT_APP_NAME ) =>
78- path . replace ( new RegExp ( `${ appName } /` ) , '' )
78+ path . replace ( new RegExp ( `^ ${ appName } /` ) , '' )
7979
8080/**
8181 * Replaces DEFAULT_APP_PACKAGE and DEFAULT_APP_NAME in str with custom
You can’t perform that action at this time.
0 commit comments