Skip to content

Commit

Permalink
fix: current eslint (enums)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Nov 15, 2023
1 parent 38a3ebf commit f834979
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/commands/package/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
PackageEvents,
PackageVersionCreateEventData,
PackageVersionCreateRequestResult,
PackagingSObjects,
} from '@salesforce/packaging';
import { camelCaseToTitleCase, Duration } from '@salesforce/kit';
import { requiredHubFlag } from '../../utils/hubFlag';
Expand Down Expand Up @@ -128,10 +129,10 @@ export class PackageConvert extends SfCommand<PackageVersionCreateRequestResult>
);

switch (result.Status) {
case 'Error':
case PackagingSObjects['Package2VersionStatus'].error:
this.spinner.stop();
throw new SfError(result.Error?.join('\n') ?? pvcMessages.getMessage('unknownError'));
case 'Success': {
case PackagingSObjects['Package2VersionStatus'].success: {
const successMessage = pvcMessages.getMessage(result.Status, [
result.Id,
result.SubscriberPackageVersionId,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/package/version/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,11 @@ export class PackageVersionCreateCommand extends SfCommand<PackageVersionCommand
}

switch (result.Status) {
case 'Error':
case Package2VersionStatus.error:
throw messages.createError('multipleErrors', [
result.Error?.map((e: string, i) => `${os.EOL}(${i + 1}) ${e}`).join(''),
]);
case 'Success':
case Package2VersionStatus.success:
this.log(
messages.getMessage(result.Status, [
result.Id,
Expand Down
13 changes: 7 additions & 6 deletions test/commands/package/packageVersion.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,15 @@ describe('package:version:*', () => {
const project = await SfProject.resolve();
const projectJson = project.getSfProjectJson();
const contents = projectJson.getContents();
const packageDir = contents.packageDirectories.find((pkgDir) => pkgDir.package === pkgName);
if (packageDir) {
packageDir.package = packageId;
} else {
if (!contents.packageDirectories.some((pkgDir) => pkgDir.package === packageId)) {
expect.fail('packageDirectory not found');
}
projectJson.setContents(contents);
projectJson.writeSync(contents);
const newPackageDirs = contents.packageDirectories.map((pkgDir) =>
pkgDir.package === pkgName ? { ...pkgDir, package: packageId } : pkgDir
);

projectJson.set('packageDirectories', newPackageDirs);
projectJson.writeSync();
execCmd(`package:version:create --package ${packageId} -x --json`, { ensureExitCode: 0 });
});
});
Expand Down

0 comments on commit f834979

Please sign in to comment.