Skip to content

Commit

Permalink
fix: allow uppercase keys inside project.plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Jun 21, 2024
1 parent 785afbb commit 5b112f8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/sfProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export type ProjectJson = ConfigContents & ProjectJsonSchema;
*/
export class SfProjectJson extends ConfigFile<ConfigFile.Options, ProjectJson> {
/** json properties that are uppercase, or allow uppercase keys inside them */
public static BLOCKLIST = ['packageAliases'];
public static BLOCKLIST = ['packageAliases', 'plugins'];

public static getFileName(): string {
return SFDX_PROJECT_JSON;
Expand Down
43 changes: 31 additions & 12 deletions test/unit/projectTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,38 @@ describe('SfProject', () => {
});

describe('json', () => {
it('allows uppercase packaging aliases on write', async () => {
const json = await SfProjectJson.create();
json.set('packageAliases', { MyName: 'somePackage' });
await json.write();
// @ts-expect-error possibly undefined
expect($$.getConfigStubContents('SfProjectJson').packageAliases['MyName']).to.equal('somePackage');
});
it('allows uppercase packaging aliases on read', async () => {
$$.setConfigStubContents('SfProjectJson', { contents: { packageAliases: { MyName: 'somePackage' } } });
const json = await SfProjectJson.create();
// @ts-expect-error possibly undefined
expect(json.get('packageAliases')['MyName']).to.equal('somePackage');
describe('allowed uppercase', () => {
describe('packageAliases', () => {
it('allows uppercase packaging aliases on write', async () => {
const json = await SfProjectJson.create();
json.set('packageAliases', { MyName: 'somePackage' });
await json.write();
// @ts-expect-error possibly undefined
expect($$.getConfigStubContents('SfProjectJson').packageAliases['MyName']).to.equal('somePackage');
});
it('allows uppercase packaging aliases on read', async () => {
$$.setConfigStubContents('SfProjectJson', { contents: { packageAliases: { MyName: 'somePackage' } } });
const json = await SfProjectJson.create();
// @ts-expect-error possibly undefined
expect(json.get('packageAliases')['MyName']).to.equal('somePackage');
});
});
describe('plugins', () => {
const pluginsContent = { SomePlugin: 'value', SomeOtherPlugin: { NestedCap: true } };
it('allows uppercase packaging aliases on write', async () => {
const json = await SfProjectJson.create();
json.set('plugins', pluginsContent);
await json.write();
expect($$.getConfigStubContents('SfProjectJson').plugins).to.deep.equal(pluginsContent);
});
it('allows uppercase packaging aliases on read', async () => {
$$.setConfigStubContents('SfProjectJson', { contents: { plugins: pluginsContent } });
const json = await SfProjectJson.create();
expect(json.get('plugins')).to.deep.equal(pluginsContent);
});
});
});

it('getPackageDirectories should transform packageDir paths to have path separators that match the OS', async () => {
let defaultPP: string;
let transformedDefaultPP: string;
Expand Down

0 comments on commit 5b112f8

Please sign in to comment.