Skip to content

Commit 5aa593d

Browse files
fix: minor package fixes (#152)
1 parent 65e5d24 commit 5aa593d

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

src/formatters/retrieveResultFormatter.ts

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export class RetrieveResultFormatter extends ResultFormatter {
9595

9696
// Display any package retrievals
9797
if (this.packages && this.packages.length) {
98+
this.ux.log('');
9899
this.ux.styledHeader(blue('Retrieved Packages'));
99100
this.packages.forEach((pkg) => {
100101
this.ux.log(`${pkg.name} package converted and retrieved to: ${pkg.path}`);

test/formatters/retrieveResultFormatter.test.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77

8+
import { join } from 'path';
89
import * as sinon from 'sinon';
910
import { expect } from 'chai';
1011
import { Logger } from '@salesforce/core';
@@ -78,14 +79,15 @@ describe('RetrieveResultFormatter', () => {
7879
expect(formatter.getJson()).to.deep.equal(expectedInProgressResults);
7980
});
8081

81-
it.skip('should return expected json for a success with packages', async () => {
82+
it('should return expected json for a success with packages', async () => {
83+
const testPkg = { name: 'testPkg', path: join('path', 'to', 'testPkg') };
8284
const expectedSuccessResults: RetrieveCommandResult = {
8385
inboundFiles: retrieveResultSuccess.getFileResponses(),
84-
packages: [],
86+
packages: [testPkg],
8587
warnings: [],
8688
response: cloneJson(retrieveResultSuccess.response),
8789
};
88-
const formatter = new RetrieveResultFormatter(logger, ux, {}, retrieveResultSuccess);
90+
const formatter = new RetrieveResultFormatter(logger, ux, { packages: [testPkg] }, retrieveResultSuccess);
8991
expect(formatter.getJson()).to.deep.equal(expectedSuccessResults);
9092
});
9193

@@ -127,10 +129,11 @@ describe('RetrieveResultFormatter', () => {
127129
.and.contain(`${options.waitTime} minutes`);
128130
});
129131

130-
it.skip('should output as expected for a Failure', async () => {
131-
const formatter = new RetrieveResultFormatter(logger, ux, {}, retrieveResultInProgress);
132+
it('should output as expected for a Failure', async () => {
133+
const formatter = new RetrieveResultFormatter(logger, ux, {}, retrieveResultFailure);
134+
sandbox.stub(formatter, 'isSuccess').returns(false);
135+
132136
formatter.display();
133-
expect(styledHeaderStub.called).to.equal(true);
134137
expect(logStub.called).to.equal(true);
135138
expect(tableStub.called).to.equal(false);
136139
expect(logStub.firstCall.args[0]).to.contain('Retrieve Failed due to:');

test/nuts/seeds/retrieve.packagenames.seed.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { exec } from 'shelljs';
1313
const EXECUTABLE = '%EXECUTABLE%';
1414

1515
const ELECTRON = { id: '04t6A000002zgKSQAY', name: 'ElectronBranding' };
16-
const SKUID = { id: '04t4A000000cESSQA2', name: 'Skuid' };
16+
const ESCAPEROOM = { id: '04t0P000000JFs1QAG', name: 'DFXP Escape Room' };
1717

1818
context('Retrieve packagenames NUTs [exec: %EXECUTABLE%]', () => {
1919
let testkit: SourceTestkit;
@@ -47,10 +47,10 @@ context('Retrieve packagenames NUTs [exec: %EXECUTABLE%]', () => {
4747

4848
it('should retrieve two installed packages', async () => {
4949
exec(`sfdx force:package:install --noprompt --package ${ELECTRON.id} --wait 5 --json`, { silent: true });
50-
exec(`sfdx force:package:install --noprompt --package ${SKUID.id} --wait 5 --json`, { silent: true });
50+
exec(`sfdx force:package:install --noprompt --package ${ESCAPEROOM.id} --wait 5 --json`, { silent: true });
5151

52-
await testkit.retrieve({ args: `--packagenames "${ELECTRON.name}, ${SKUID.name}"` });
53-
await testkit.expect.packagesToBeRetrieved([ELECTRON.name, SKUID.name]);
52+
await testkit.retrieve({ args: `--packagenames "${ELECTRON.name}, ${ESCAPEROOM.name}"` });
53+
await testkit.expect.packagesToBeRetrieved([ELECTRON.name, ESCAPEROOM.name]);
5454
});
5555

5656
it('should retrieve an installed package and sourcepath', async () => {

0 commit comments

Comments
 (0)