Skip to content

Commit

Permalink
test: ut for mdapi line/col numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Oct 5, 2023
1 parent 2dfb42c commit 8bc3162
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/client/metadataApiDeploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export class DeployResult implements MetadataTransferResult {
? {
error: c.problem,
problemType: c.problemType,
columnNumber: c.columnNumber ? parseInt(c.columnNumber, 10) : undefined,
lineNumber: c.lineNumber ? parseInt(c.lineNumber, 10) : undefined,
}
: {}),
fullName: c.fullName,
Expand Down
48 changes: 48 additions & 0 deletions test/client/metadataApiDeploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,54 @@ describe('MetadataApiDeploy', () => {
expect(responses).to.deep.equal(expected);
});

it('should return line/col numbers for mdapi deploy', () => {
const component = matchingContentFile.COMPONENT;
const { fullName, type } = component;
const problem = 'something went wrong';
const problemType = 'Error';
const apiStatus: Partial<MetadataApiDeployStatus> = {
details: {
componentFailures: [
{
changed: 'false',
created: 'false',
deleted: 'false',
success: 'false',
lineNumber: '3',
columnNumber: '5',
problem,
problemType,
fullName,
fileName: component.content,
componentType: type.name,
} as DeployMessage,
{
changed: 'false',
created: 'false',
deleted: 'false',
success: 'false',
lineNumber: '12',
columnNumber: '3',
problem,
problemType,
fullName,
fileName: component.content,
componentType: type.name,
} as DeployMessage,
],
},
};
// intentionally don't include the componentSet
const result = new DeployResult(apiStatus as MetadataApiDeployStatus);
const fileResponses = result.getFileResponses();
assert(fileResponses[0].state === ComponentStatus.Failed);
expect(fileResponses[0].lineNumber).equal(3);
expect(fileResponses[0].columnNumber).equal(5);
assert(fileResponses[1].state === ComponentStatus.Failed);
expect(fileResponses[1].lineNumber).equal(12);
expect(fileResponses[1].columnNumber).equal(3);
});

it('should aggregate diagnostics for a component', () => {
const component = matchingContentFile.COMPONENT;
const deployedSet = new ComponentSet([component]);
Expand Down

2 comments on commit 8bc3162

@svc-cli-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 8bc3162 Previous: 61dddfb Ratio
eda-componentSetCreate-linux 359 ms 278 ms 1.29
eda-sourceToMdapi-linux 8372 ms 8945 ms 0.94
eda-sourceToZip-linux 5901 ms 5619 ms 1.05
eda-mdapiToSource-linux 5297 ms 4678 ms 1.13
lotsOfClasses-componentSetCreate-linux 620 ms 501 ms 1.24
lotsOfClasses-sourceToMdapi-linux 11504 ms 10890 ms 1.06
lotsOfClasses-sourceToZip-linux 8338 ms 8127 ms 1.03
lotsOfClasses-mdapiToSource-linux 5654 ms 4343 ms 1.30
lotsOfClassesOneDir-componentSetCreate-linux 1001 ms 851 ms 1.18
lotsOfClassesOneDir-sourceToMdapi-linux 15165 ms 14394 ms 1.05
lotsOfClassesOneDir-sourceToZip-linux 14256 ms 12836 ms 1.11
lotsOfClassesOneDir-mdapiToSource-linux 9976 ms 8534 ms 1.17

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 8bc3162 Previous: 61dddfb Ratio
eda-componentSetCreate-win32 586 ms 631 ms 0.93
eda-sourceToMdapi-win32 9221 ms 10152 ms 0.91
eda-sourceToZip-win32 7585 ms 7419 ms 1.02
eda-mdapiToSource-win32 9859 ms 9495 ms 1.04
lotsOfClasses-componentSetCreate-win32 1329 ms 1265 ms 1.05
lotsOfClasses-sourceToMdapi-win32 17386 ms 18513 ms 0.94
lotsOfClasses-sourceToZip-win32 11464 ms 11050 ms 1.04
lotsOfClasses-mdapiToSource-win32 12259 ms 11650 ms 1.05
lotsOfClassesOneDir-componentSetCreate-win32 2193 ms 2006 ms 1.09
lotsOfClassesOneDir-sourceToMdapi-win32 27795 ms 27031 ms 1.03
lotsOfClassesOneDir-sourceToZip-win32 19217 ms 17861 ms 1.08
lotsOfClassesOneDir-mdapiToSource-win32 22284 ms 21147 ms 1.05

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.