Skip to content

Commit

Permalink
test: add UT to cover new behavoir
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Oct 31, 2023
1 parent 45aece8 commit aaa9f15
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/convert/transformers/decomposedMetadataTransformer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,55 @@ describe('DecomposedMetadataTransformer', () => {
]);
});

it('should merge unaddressableWithoutParent types with their parent, regardless of location', async () => {
const cot = DECOMPOSED_TOP_LEVEL_COMPONENT;
const cft = DECOMPOSED_TOP_LEVEL_COMPONENT;
const { type, fullName } = cot;

const transformer = new DecomposedMetadataTransformer();
const root = join('path', 'to', type.directoryName, fullName);
$$.SANDBOX.stub(cot, 'parseXml').resolves({
CustomObjectTranslation: {
fields: [
{ name: 'child', test: 'testVal' },
{ name: 'child2', test: 'testVal2' },
],
},
});

const result = await transformer.toSourceFormat(cft, cot);

expect(result).to.deep.equal([
{
source: new JsToXml({
CustomFieldTranslation: {
[XML_NS_KEY]: XML_NS_URL,
name: 'child',
test: 'testVal',
},
}),
output: join(root, 'child.fieldTranslation-meta.xml'),
},
{
source: new JsToXml({
CustomFieldTranslation: {
[XML_NS_KEY]: XML_NS_URL,
name: 'child2',
test: 'testVal2',
},
}),
output: join(root, 'child2.fieldTranslation-meta.xml'),
},
// the new parent was written
{
source: new JsToXml({
[type.name]: '',
}),
output: join(root, 'myObject__c.objectTranslation-meta.xml'),
},
]);
});

it('should handle decomposed parents with no files', async () => {
const transformer = new DecomposedMetadataTransformer();
$$.SANDBOX.stub(component, 'parseXml').resolves({});
Expand Down

2 comments on commit aaa9f15

@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: aaa9f15 Previous: 45aece8 Ratio
eda-componentSetCreate-linux 382 ms 276 ms 1.38
eda-sourceToMdapi-linux 8586 ms 8091 ms 1.06
eda-sourceToZip-linux 6390 ms 6308 ms 1.01
eda-mdapiToSource-linux 5467 ms 4351 ms 1.26
lotsOfClasses-componentSetCreate-linux 705 ms 579 ms 1.22
lotsOfClasses-sourceToMdapi-linux 11284 ms 10528 ms 1.07
lotsOfClasses-sourceToZip-linux 7731 ms 8098 ms 0.95
lotsOfClasses-mdapiToSource-linux 6241 ms 4682 ms 1.33
lotsOfClassesOneDir-componentSetCreate-linux 1203 ms 961 ms 1.25
lotsOfClassesOneDir-sourceToMdapi-linux 16846 ms 13516 ms 1.25
lotsOfClassesOneDir-sourceToZip-linux 12257 ms 12635 ms 0.97
lotsOfClassesOneDir-mdapiToSource-linux 11485 ms 8314 ms 1.38

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: aaa9f15 Previous: 45aece8 Ratio
eda-componentSetCreate-win32 631 ms 583 ms 1.08
eda-sourceToMdapi-win32 10001 ms 9928 ms 1.01
eda-sourceToZip-win32 7391 ms 7974 ms 0.93
eda-mdapiToSource-win32 9898 ms 9084 ms 1.09
lotsOfClasses-componentSetCreate-win32 1406 ms 1203 ms 1.17
lotsOfClasses-sourceToMdapi-win32 16988 ms 17143 ms 0.99
lotsOfClasses-sourceToZip-win32 10814 ms 9723 ms 1.11
lotsOfClasses-mdapiToSource-win32 11564 ms 11162 ms 1.04
lotsOfClassesOneDir-componentSetCreate-win32 2185 ms 2134 ms 1.02
lotsOfClassesOneDir-sourceToMdapi-win32 27259 ms 25496 ms 1.07
lotsOfClassesOneDir-sourceToZip-win32 18209 ms 15975 ms 1.14
lotsOfClassesOneDir-mdapiToSource-win32 21509 ms 20009 ms 1.07

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

Please sign in to comment.