Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/resolve/adapters/webApplicationsSourceAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class WebApplicationsSourceAdapter extends BundleSourceAdapter {
? source
: new SourceComponent(
{
name: source.name,
name: appName,
type: source.type,
content: source.content,
xml: expectedXmlPath,
Expand Down
52 changes: 51 additions & 1 deletion test/resolve/adapters/webApplicationsSourceAdapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import { join } from 'node:path';
import { assert, expect } from 'chai';
import { Messages, SfError } from '@salesforce/core';
import { ForceIgnore, RegistryAccess, SourceComponent, VirtualTreeContainer, registry } from '../../../src';
import { ForceIgnore, RegistryAccess, SourceComponent, VirtualDirectory, VirtualTreeContainer, registry } from '../../../src';
import { WebApplicationsSourceAdapter } from '../../../src/resolve/adapters';
import { RegistryTestUtil } from '../registryTestUtil';

Expand Down Expand Up @@ -152,4 +152,54 @@ describe('WebApplicationsSourceAdapter', () => {
);
testUtil.restore();
});

describe('app name case', () => {
const buildAdapterWithAppName = (appName: string) => {
const appPath = join(BASE_PATH, appName);
const metaFile = join(appPath, `${appName}.webapplication-meta.xml`);
const config = { outputDir: 'src', routing: { trailingSlash: 'auto', fallback: '/index.html' } };
const vfs: VirtualDirectory[] = [
{
dirPath: appPath,
children: [
`${appName}.webapplication-meta.xml`,
{ name: 'webapplication.json', data: Buffer.from(JSON.stringify(config)) },
'src',
],
},
{ dirPath: join(appPath, 'src'), children: ['index.html'] },
];
const t = new VirtualTreeContainer(vfs);
return {
adapter: new WebApplicationsSourceAdapter(registry.types.webapplication, registryAccess, forceIgnore, t),
appPath,
metaFile,
};
};

it('should preserve mixed-case app name (MyApp)', () => {
const { adapter, appPath, metaFile } = buildAdapterWithAppName('MyApp');
const comp = adapter.getComponent(appPath);
expect(comp).to.not.be.undefined;
expect(comp!.name).to.equal('MyApp');
expect(comp!.fullName).to.equal('MyApp');
expect(comp!.xml).to.equal(metaFile);
});

it('should preserve lowercase app name (myapp)', () => {
const { adapter, appPath } = buildAdapterWithAppName('myapp');
const comp = adapter.getComponent(appPath);
expect(comp).to.not.be.undefined;
expect(comp!.name).to.equal('myapp');
expect(comp!.fullName).to.equal('myapp');
});

it('should preserve uppercase app name (MYAPP)', () => {
const { adapter, appPath } = buildAdapterWithAppName('MYAPP');
const comp = adapter.getComponent(appPath);
expect(comp).to.not.be.undefined;
expect(comp!.name).to.equal('MYAPP');
expect(comp!.fullName).to.equal('MYAPP');
});
});
});
Loading