Skip to content

Commit

Permalink
chore: linter changes for enums
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Nov 6, 2023
1 parent b12a915 commit b4b6b15
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/package/packageVersionCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -715,12 +715,12 @@ export class PackageVersionCreate {
private async validateOptionsForPackageType(): Promise<void> {
if ((await this.getPackageType()) === 'Unlocked') {
// Don't allow scripts in unlocked packages
if (this.options.postinstallscript || this.options.uninstallscript) {
if (Boolean(this.options.postinstallscript) || this.options.uninstallscript) {
throw messages.createError('errorScriptsNotApplicableToUnlockedPackage');
}

// Don't allow ancestor in unlocked packages
if (this.packageObject.ancestorId || this.packageObject.ancestorVersion) {
if (Boolean(this.packageObject.ancestorId) || this.packageObject.ancestorVersion) {
throw messages.createError('errorAncestorNotApplicableToUnlockedPackage');
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/package/packageVersionCreateRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import Package2VersionCreateRequestError = PackagingSObjects.Package2VersionCrea
Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/packaging', 'package_version_create');

const STATUS_ERROR = 'Error';
const QUERY =
'SELECT Id, Status, Package2Id, Package2VersionId, Package2Version.SubscriberPackageVersionId, Tag, Branch, ' +
'CreatedDate, Package2Version.HasMetadataRemoved, CreatedById, IsConversionRequest, Package2Version.ConvertedFromVersionId ' +
Expand Down Expand Up @@ -54,7 +53,7 @@ export async function byId(
connection: Connection
): Promise<PackageVersionCreateRequestResult[]> {
const results = await query(util.format(QUERY, `WHERE Id = '${packageVersionCreateRequestId}' `), connection);
if (results && results.length === 1 && results[0].Status === STATUS_ERROR) {
if (results && results.length === 1 && results[0].Status === PackagingSObjects.Package2VersionStatus.error) {
results[0].Error = await queryForErrors(packageVersionCreateRequestId, connection);
}

Expand Down
2 changes: 1 addition & 1 deletion src/package/subscriberPackageVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export class SubscriberPackageVersion {
public async getData(
options: { force?: boolean; includeHighCostFields?: boolean } = { force: false, includeHighCostFields: false }
): Promise<PackagingSObjects.SubscriberPackageVersion | undefined> {
if (!this.data || options.force || options.includeHighCostFields) {
if (!this.data || Boolean(options.force) || options.includeHighCostFields) {
const queryFields = this.getFieldsForQuery(options);
if (queryFields.length === 0) {
return this.data;
Expand Down
4 changes: 2 additions & 2 deletions test/package/packageTest.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ describe('Integration tests for @salesforce/packaging library', () => {
const result = await PackageVersion.getCreateStatus(pkgCreateVersionRequestId, devHubOrg.getConnection());
expect(result).to.include.keys(VERSION_CREATE_RESPONSE_KEYS);

if (result.Status === 'Error') {
if (result.Status === PackagingSObjects.Package2VersionStatus.error) {
throw new Error(`pv.getCreateVersionReport failed with status Error: ${result.Error.join(';')}`);
}
});
Expand Down Expand Up @@ -236,7 +236,7 @@ describe('Integration tests for @salesforce/packaging library', () => {

subscriberPkgVersionId = result.SubscriberPackageVersionId ?? '';

if (result.Status === 'Error') {
if (result.Status === PackagingSObjects.Package2VersionStatus.error) {
throw new Error(`pv.waitForCreateVersion failed with status Error: ${result.Error.join(';')}`);
}
});
Expand Down

0 comments on commit b4b6b15

Please sign in to comment.