Skip to content

Commit 8aef611

Browse files
lesya7cursoragent
andcommitted
fix: allow WebApplication app name in any case, add tests
- Remove lowercase normalization; preserve folder/meta xml case - Add tests for MyApp, myapp, MYAPP Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 0017132 commit 8aef611

2 files changed

Lines changed: 51 additions & 1 deletion

File tree

src/resolve/adapters/webApplicationsSourceAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class WebApplicationsSourceAdapter extends BundleSourceAdapter {
6363
? source
6464
: new SourceComponent(
6565
{
66-
name: source.name,
66+
name: appName,
6767
type: source.type,
6868
content: source.content,
6969
xml: expectedXmlPath,

test/resolve/adapters/webApplicationsSourceAdapter.test.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)