Skip to content

Commit 982a2f2

Browse files
committed
fix: pass installation key when getting external sites
1 parent 4680be9 commit 982a2f2

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/commands/force/package/beta/install.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export class Install extends SfdxCommand {
178178
}
179179

180180
private async confirmExternalSites(request: PackageInstallCreateRequest, noPrompt: boolean): Promise<void> {
181-
const extSites = await this.pkg.getExternalSites(request.SubscriberPackageVersionKey);
181+
const extSites = await this.pkg.getExternalSites(request.SubscriberPackageVersionKey, request.Password);
182182
if (extSites) {
183183
let enableRss = true;
184184
if (!noPrompt) {

test/commands/force/package/install.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,25 @@ describe('force:package:install', () => {
395395
expect(result).to.deep.equal(pkgInstallRequest);
396396
});
397397

398+
it('should NOT confirm external sites with --noprompt flag and installation key', async () => {
399+
const installationkey = '1234abcd';
400+
const expectedCreateRequest = Object.assign({}, pkgInstallCreateRequest, {
401+
EnableRss: true,
402+
Password: installationkey,
403+
});
404+
getExternalSitesStub.resolves(extSites);
405+
installStub.resolves(pkgInstallRequest);
406+
407+
const result = await runCmd(['-p', '04t6A000002zgKSQAY', '--noprompt', '-k', installationkey], true);
408+
409+
expect(getExternalSitesStub.calledOnce).to.be.true;
410+
expect(getExternalSitesStub.args[0][0]).to.equal(pkgInstallCreateRequest.SubscriberPackageVersionKey);
411+
expect(getExternalSitesStub.args[0][1]).to.equal(installationkey);
412+
expect(uxConfirmStub.calledOnce).to.be.false;
413+
expect(installStub.args[0][0]).to.deep.equal(expectedCreateRequest);
414+
expect(result).to.deep.equal(pkgInstallRequest);
415+
});
416+
398417
it('should confirm external sites when NO --noprompt flag (yes answer)', async () => {
399418
const expectedCreateRequest = Object.assign({}, pkgInstallCreateRequest, { EnableRss: true });
400419
getExternalSitesStub.resolves(extSites);

0 commit comments

Comments
 (0)