Skip to content

Commit

Permalink
fix: update title table
Browse files Browse the repository at this point in the history
  • Loading branch information
soridalac committed Oct 31, 2024
1 parent 225e4df commit e3ce783
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/commands/org/delete/shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export class OrgShapeDeleteCommand extends SfCommand<OrgShapeDeleteResult | unde
if (deleteRes.failures.length > 0) {
setExitCode(68);

this.styledHeader('Partial Success');
this.logSuccess(messages.getMessage('humanSuccess', [orgId]));
this.log('');
this.styledHeader('Failures');
Expand All @@ -79,6 +78,7 @@ export class OrgShapeDeleteCommand extends SfCommand<OrgShapeDeleteResult | unde
{ key: 'shapeId', name: 'Shape ID' },
{ key: 'message', name: 'Error Message' },
],
title: 'Failures',
});
} else if (deleteRes.failures.length === deleteRes.shapeIds.length) {
setExitCode(1);
Expand Down
3 changes: 2 additions & 1 deletion src/commands/org/list/shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ export class OrgShapeListCommand extends SfCommand<OrgShapeListResult[]> {
this.info(messages.getMessage('noOrgShapes'));
return orgShapes;
}
this.styledHeader('Org Shapes');
// this.styledHeader('Org Shapes');
this.table({
data: orgShapes.map((shape) => ({
...(shape.status === 'Active' ? { ...shape, status: StandardColors.success(shape.status) } : shape),
})),
title: 'Org Shapes',
});
return orgShapes;
}
Expand Down
5 changes: 1 addition & 4 deletions test/shape/delete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ describe('org:shape:delete', () => {
// stubs
let uxLogStub: sinon.SinonStub;
let uxTableStub: sinon.SinonStub;
let uxStyledHeaderStub: sinon.SinonStub;

beforeEach(async () => {
await config.load();
uxLogStub = sandbox.stub(SfCommand.prototype, 'log');
uxStyledHeaderStub = sandbox.stub(SfCommand.prototype, 'styledHeader');
uxTableStub = sandbox.stub(SfCommand.prototype, 'table');

await $$.stubAuths(testOrg);
Expand Down Expand Up @@ -122,16 +120,15 @@ describe('org:shape:delete', () => {
const command = new OrgShapeDeleteCommand(['--noprompt', '--targetusername', testOrg.username], config);
await command.run();

expect(uxStyledHeaderStub.firstCall.args[0]).to.equal('Partial Success');
expect(uxLogStub.getCalls().some((c) => c.args[0] === 'Successfully deleted org shape for 00D000000000000004.'));
expect(uxLogStub.getCalls().some((c) => c.args[0] === ''));
expect(uxStyledHeaderStub.secondCall.args[0]).to.equal('Failures');
expect(uxTableStub.firstCall.args[0]).to.deep.equal({
data: [{ shapeId: '3SR000000000124', message: 'MALFORMED ID' }],
columns: [
{ key: 'shapeId', name: 'Shape ID' },
{ key: 'message', name: 'Error Message' },
],
title: 'Failures',
});
});

Expand Down
4 changes: 1 addition & 3 deletions test/shape/list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ describe('org:shape:list', () => {
// stubs
let uxLogStub: sinon.SinonStub;
let uxTableStub: sinon.SinonStub;
let uxStyledHeaderStub: sinon.SinonStub;

const $$ = new TestContext();
const testOrg = new MockTestOrgData();
Expand All @@ -33,7 +32,6 @@ describe('org:shape:list', () => {
beforeEach(async () => {
await config.load();
uxLogStub = sandbox.stub(SfCommand.prototype, 'log');
uxStyledHeaderStub = sandbox.stub(SfCommand.prototype, 'styledHeader');
uxTableStub = sandbox.stub(SfCommand.prototype, 'table');
});

Expand Down Expand Up @@ -78,12 +76,12 @@ describe('org:shape:list', () => {
const command = new OrgShapeListCommand([], config);
await command.run();
expect(uxLogStub.notCalled).to.be.true;
expect(uxStyledHeaderStub.firstCall.args[0]).to.equal('Org Shapes');
expect((uxTableStub.firstCall.args[0] as { data: OrgShapeListResult[] }).data.length).to.equal(2);
expect(uxTableStub.firstCall.args[0]).to.deep.equal({
data: shapes.map((shape) => ({
...(shape.status === 'Active' ? { ...shape, status: StandardColors.success(shape.status) } : shape),
})),
title: 'Org Shapes',
});
});

Expand Down

0 comments on commit e3ce783

Please sign in to comment.