@@ -192,6 +192,56 @@ describe('WebApplicationsSourceAdapter', () => {
192192 } ) ;
193193 } ) ;
194194
195+ describe ( 'app name case' , ( ) => {
196+ const buildAdapterWithAppName = ( appName : string ) => {
197+ const appPath = join ( BASE_PATH , appName ) ;
198+ const metaFile = join ( appPath , `${ appName } .webapplication-meta.xml` ) ;
199+ const distPath = join ( appPath , 'dist' ) ;
200+ const config = { outputDir : 'dist' , routing : { trailingSlash : 'auto' , fallback : '/index.html' } } ;
201+ const vfs : VirtualDirectory [ ] = [
202+ {
203+ dirPath : appPath ,
204+ children : [
205+ `${ appName } .webapplication-meta.xml` ,
206+ { name : 'webapplication.json' , data : Buffer . from ( JSON . stringify ( config ) ) } ,
207+ ] ,
208+ } ,
209+ { dirPath : distPath , children : [ { name : 'index.html' , data : Buffer . from ( '<html>test</html>' ) } ] } ,
210+ ] ;
211+ const t = new VirtualTreeContainer ( vfs ) ;
212+ return {
213+ adapter : new WebApplicationsSourceAdapter ( registry . types . webapplication , registryAccess , forceIgnore , t ) ,
214+ appPath,
215+ metaFile,
216+ } ;
217+ } ;
218+
219+ it ( 'should preserve mixed-case app name (MyApp)' , ( ) => {
220+ const { adapter, appPath, metaFile } = buildAdapterWithAppName ( 'MyApp' ) ;
221+ const comp = adapter . getComponent ( appPath ) ;
222+ expect ( comp ) . to . not . be . undefined ;
223+ expect ( comp ! . name ) . to . equal ( 'MyApp' ) ;
224+ expect ( comp ! . fullName ) . to . equal ( 'MyApp' ) ;
225+ expect ( comp ! . xml ) . to . equal ( metaFile ) ;
226+ } ) ;
227+
228+ it ( 'should preserve lowercase app name (myapp)' , ( ) => {
229+ const { adapter, appPath } = buildAdapterWithAppName ( 'myapp' ) ;
230+ const comp = adapter . getComponent ( appPath ) ;
231+ expect ( comp ) . to . not . be . undefined ;
232+ expect ( comp ! . name ) . to . equal ( 'myapp' ) ;
233+ expect ( comp ! . fullName ) . to . equal ( 'myapp' ) ;
234+ } ) ;
235+
236+ it ( 'should preserve uppercase app name (MYAPP)' , ( ) => {
237+ const { adapter, appPath } = buildAdapterWithAppName ( 'MYAPP' ) ;
238+ const comp = adapter . getComponent ( appPath ) ;
239+ expect ( comp ) . to . not . be . undefined ;
240+ expect ( comp ! . name ) . to . equal ( 'MYAPP' ) ;
241+ expect ( comp ! . fullName ) . to . equal ( 'MYAPP' ) ;
242+ } ) ;
243+ } ) ;
244+
195245 describe ( 'webapplication.json validation' , ( ) => {
196246 // helper: build an adapter whose tree has the given webapplication.json content
197247 // plus optional extra VirtualDirectory entries for dist, etc.
0 commit comments