Skip to content

Commit

Permalink
fix: minor package fixes (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele authored Jul 26, 2021
1 parent 65e5d24 commit 5aa593d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/formatters/retrieveResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export class RetrieveResultFormatter extends ResultFormatter {

// Display any package retrievals
if (this.packages && this.packages.length) {
this.ux.log('');
this.ux.styledHeader(blue('Retrieved Packages'));
this.packages.forEach((pkg) => {
this.ux.log(`${pkg.name} package converted and retrieved to: ${pkg.path}`);
Expand Down
15 changes: 9 additions & 6 deletions test/formatters/retrieveResultFormatter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { join } from 'path';
import * as sinon from 'sinon';
import { expect } from 'chai';
import { Logger } from '@salesforce/core';
Expand Down Expand Up @@ -78,14 +79,15 @@ describe('RetrieveResultFormatter', () => {
expect(formatter.getJson()).to.deep.equal(expectedInProgressResults);
});

it.skip('should return expected json for a success with packages', async () => {
it('should return expected json for a success with packages', async () => {
const testPkg = { name: 'testPkg', path: join('path', 'to', 'testPkg') };
const expectedSuccessResults: RetrieveCommandResult = {
inboundFiles: retrieveResultSuccess.getFileResponses(),
packages: [],
packages: [testPkg],
warnings: [],
response: cloneJson(retrieveResultSuccess.response),
};
const formatter = new RetrieveResultFormatter(logger, ux, {}, retrieveResultSuccess);
const formatter = new RetrieveResultFormatter(logger, ux, { packages: [testPkg] }, retrieveResultSuccess);
expect(formatter.getJson()).to.deep.equal(expectedSuccessResults);
});

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

it.skip('should output as expected for a Failure', async () => {
const formatter = new RetrieveResultFormatter(logger, ux, {}, retrieveResultInProgress);
it('should output as expected for a Failure', async () => {
const formatter = new RetrieveResultFormatter(logger, ux, {}, retrieveResultFailure);
sandbox.stub(formatter, 'isSuccess').returns(false);

formatter.display();
expect(styledHeaderStub.called).to.equal(true);
expect(logStub.called).to.equal(true);
expect(tableStub.called).to.equal(false);
expect(logStub.firstCall.args[0]).to.contain('Retrieve Failed due to:');
Expand Down
8 changes: 4 additions & 4 deletions test/nuts/seeds/retrieve.packagenames.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { exec } from 'shelljs';
const EXECUTABLE = '%EXECUTABLE%';

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

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

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

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

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

0 comments on commit 5aa593d

Please sign in to comment.