Skip to content

Commit 1255c1c

Browse files
committed
fix: fix promote nut test
1 parent 7c98fdb commit 1255c1c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/commands/force/package/beta/version/promote.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ export class PackageVersionPromoteCommand extends SfdxCommand {
4343

4444
public async run(): Promise<PackageSaveResult> {
4545
const conn = this.hubOrg.getConnection();
46-
let packageId = getPackageIdFromAlias(this.flags.package, this.project) ?? (this.flags.package as string);
47-
46+
const packageIdFromAlias =
47+
getPackageIdFromAlias(this.flags.package, this.project) ?? (this.flags.package as string);
48+
let packageId = packageIdFromAlias;
4849
// ID can be 04t or 05i at this point
4950
validateId([BY_LABEL.SUBSCRIBER_PACKAGE_VERSION_ID, BY_LABEL.PACKAGE_VERSION_ID], packageId);
5051

@@ -70,6 +71,7 @@ export class PackageVersionPromoteCommand extends SfdxCommand {
7071

7172
try {
7273
result = await pkg.promote(packageId);
74+
result.id = packageIdFromAlias.startsWith('04t') ? packageIdFromAlias : result.id;
7375
} catch (e) {
7476
const err = SfError.wrap(e);
7577
if (err.name === 'DUPLICATE_VALUE' && err.message.includes('previously released')) {

test/commands/force/package/versionPromoteUpdate.nut.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('package:version:promote / package:version:update', () => {
6464
ensureExitCode: 0,
6565
}).shellOutput.stdout;
6666
expect(result).to.contain('Successfully promoted the package version');
67-
expect(result).to.contain('04t');
67+
expect(result).to.contain('04t', result);
6868
expect(result).to.contain(
6969
'to released. Starting in Winter ‘21, only unlocked package versions that have met the minimum 75% code coverage requirement can be promoted. Code coverage minimums aren’t enforced on org-dependent unlocked packages.'
7070
);
@@ -78,7 +78,7 @@ describe('package:version:promote / package:version:update', () => {
7878
}
7979
).jsonOutput.result;
8080
expect(result).to.have.all.keys('id', 'success', 'errors');
81-
expect(result.id.startsWith('04t')).to.be.true;
81+
expect(result.id.slice(0, 3)).to.be.equal('04t');
8282
expect(result.success).to.equal(true);
8383
expect(result.errors).to.deep.equal([]);
8484
});

0 commit comments

Comments
 (0)