From 3a1ca98307d004c76e86506a9b85f9c6e4631c15 Mon Sep 17 00:00:00 2001 From: Willie Ruemmele Date: Mon, 24 Jun 2024 15:32:15 -0600 Subject: [PATCH 1/2] chore: change error message, add UT --- src/resolve/sourceComponent.ts | 4 +++- test/resolve/sourceComponent.test.ts | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/resolve/sourceComponent.ts b/src/resolve/sourceComponent.ts index bc459256d6..9c4092c57a 100644 --- a/src/resolve/sourceComponent.ts +++ b/src/resolve/sourceComponent.ts @@ -232,7 +232,9 @@ export class SourceComponent implements MetadataComponent { const uniqueElement = this.type.uniqueIdElement; const matched = uniqueElement ? children.find((c) => getString(c, uniqueElement) === this.name) : undefined; if (!matched) { - throw new SfError(`Unable to find matching parent xml file for ${this.xml}`); + throw new SfError( + `Invalid XML tags or unable to find matching parent xml file for ${this.type.name} "${this.name}"` + ); } return matched; } diff --git a/test/resolve/sourceComponent.test.ts b/test/resolve/sourceComponent.test.ts index f7038a383c..dde00d3a73 100644 --- a/test/resolve/sourceComponent.test.ts +++ b/test/resolve/sourceComponent.test.ts @@ -15,6 +15,7 @@ import { CHILD_1_NAME, CHILD_1_XML, CHILD_2_NAME, + CHILD_2_XML, COMPONENT_1, COMPONENT_1_XML, COMPONENT_1_XML_PATH, @@ -37,6 +38,7 @@ import { } from '../mock/type-constants/customObjectTranslationConstant'; import { DecomposedSourceAdapter } from '../../src/resolve/adapters'; import { DE_METAFILE } from '../mock/type-constants/digitalExperienceBundleConstants'; +import { XML_NS_KEY, XML_NS_URL } from '../../src/common'; import { RegistryTestUtil } from './registryTestUtil'; Messages.importMessagesDirectory(__dirname); @@ -487,6 +489,24 @@ describe('SourceComponent', () => { expect(COMPONENT_1.parseFromParentXml(COMPONENT_1_XML)).to.deep.equal(COMPONENT_1_XML); }); + it('throw an error when it cant find the parent xml', () => { + try { + expectedChild.parseFromParentXml({ + // notice "B" not "b" + CustomLaBels: { + [XML_NS_KEY]: XML_NS_URL, + [type.directoryName]: [CHILD_1_XML, CHILD_2_XML], + }, + }); + assert.fail('this should throw'); + } catch (e) { + assert(e instanceof Error); + expect(e.message).to.equal( + 'Invalid XML tags or unable to find matching parent xml file for CustomLabel "Child_1"' + ); + } + }); + // https://github.com/forcedotcom/salesforcedx-vscode/issues/3210 it('should return empty children for types that do not have uniqueIdElement but xmlPathToChildren returns elements', () => { const noUniqueIdElementType: MetadataType = JSON.parse(JSON.stringify(MATCHING_RULES_TYPE)); From c7b21ff75ea62bcb2ae2ec4eba51257ee7303600 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Fri, 28 Jun 2024 09:51:57 -0500 Subject: [PATCH 2/2] chore: bump deps for xnuts --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 6e03e3ffce..1d7709941a 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "node": ">=18.0.0" }, "dependencies": { - "@salesforce/core": "^8.0.3", + "@salesforce/core": "^8.1.0", "@salesforce/kit": "^3.1.6", "@salesforce/ts-types": "^2.0.10", "fast-levenshtein": "^3.0.0", diff --git a/yarn.lock b/yarn.lock index 86cebf8b9f..54b6653c54 100644 --- a/yarn.lock +++ b/yarn.lock @@ -502,10 +502,10 @@ "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" -"@jsforce/jsforce-node@^3.2.0": - version "3.2.0" - resolved "https://registry.yarnpkg.com/@jsforce/jsforce-node/-/jsforce-node-3.2.0.tgz#4b104613fc9bb74e0e38d2c00936ea2b228ba73a" - integrity sha512-3GjWNgWs0HFajVhIhwvBPb0B45o500wTBNEBYxy8XjeeRra+qw8A9xUrfVU7TAGev8kXuKhjJwaTiSzThpEnew== +"@jsforce/jsforce-node@^3.2.0", "@jsforce/jsforce-node@^3.2.1": + version "3.2.1" + resolved "https://registry.yarnpkg.com/@jsforce/jsforce-node/-/jsforce-node-3.2.1.tgz#00fab05919e0cbe91ae4d873377e56cfbc087b98" + integrity sha512-hjmZQbYVikm6ATmaErOp5NaKR2VofNZsrcGGHrdbGA+bAgpfg/+MA/HzRTb8BvYyPDq3RRc5A8Yk8gx9Vtcrxg== dependencies: "@sindresorhus/is" "^4" "@types/node" "^18.15.3" @@ -564,12 +564,12 @@ strip-ansi "6.0.1" ts-retry-promise "^0.8.1" -"@salesforce/core@^8.0.3": - version "8.0.3" - resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-8.0.3.tgz#8b25ce46100baef0a8e731b42d373edf508ab144" - integrity sha512-HirswUFGQIF5Ipaa+5l3kulBOf3L25Z3fzf5QqEI4vOxgBKN2bEdKHCA/PROufi3/ejFstiXcn9/jfgyjDdBqA== +"@salesforce/core@^8.0.3", "@salesforce/core@^8.1.0": + version "8.1.0" + resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-8.1.0.tgz#8ee25acdacf9d70a6249907a2fe3503461f18766" + integrity sha512-oItr8cdeMe67glJN3dP1Gh/kasD0DUT6S6RfcLTH32wwuZNQAwMXNgBOCvlskr8nxPZ+YSSw7CVuqYMUmCtUXA== dependencies: - "@jsforce/jsforce-node" "^3.2.0" + "@jsforce/jsforce-node" "^3.2.1" "@salesforce/kit" "^3.1.6" "@salesforce/schemas" "^1.9.0" "@salesforce/ts-types" "^2.0.10"