From 5de93330980ac0856abfe74ad026a3f32fb52923 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Mon, 27 Sep 2021 13:20:10 -0500 Subject: [PATCH 1/2] fix: add missing childTypes to registry --- src/registry/registry.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/registry/registry.json b/src/registry/registry.json index 2c1d96c828..456a426579 100644 --- a/src/registry/registry.json +++ b/src/registry/registry.json @@ -2629,17 +2629,23 @@ "sharingreason": "customobject", "listview": "customobject", "fieldset": "customobject", + "formsection": "form", + "workflowknowledgepublish": "workflow", "workflowfieldupdate": "workflow", "workflowtask": "workflow", "workflowalert": "workflow", "workflowsend": "workflow", "workflowoutboundmessage": "workflow", "workflowrule": "workflow", + "workskillroutingattribute": "workskillrouting", "assignmentrule": "assignmentrules", "autoresponserule": "autoresponserules", "escalationrule": "escalationrules", "matchingrule": "matchingrules", "sharingownerrule": "sharingrules", + "sharingguestrule": "sharingrules", + "sharingterritoryrule": "sharingrules", + "managedtopic": "managedtopics", "sharingcriteriarule": "sharingrules", "botversion": "bot", "customfieldtranslation": "customobjecttranslation" From 5e0076253e6d56309a07fd8cdba3fb0c60337bb4 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Mon, 27 Sep 2021 13:20:26 -0500 Subject: [PATCH 2/2] test: registry validation for complete childTypes object --- test/registry/registryValidation.test.ts | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 test/registry/registryValidation.test.ts diff --git a/test/registry/registryValidation.test.ts b/test/registry/registryValidation.test.ts new file mode 100644 index 0000000000..fe1ff6fcfc --- /dev/null +++ b/test/registry/registryValidation.test.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2021, salesforce.com, inc. + * All rights reserved. + * Licensed under the BSD 3-Clause license. + * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause + */ +import { expect } from 'chai'; +import { MetadataRegistry } from '../../src'; +import { registry as defaultRegistry } from '../../src/registry/registry'; + +describe('Registry Validation', () => { + describe('every child type has an entry in children', () => { + const registry = defaultRegistry as MetadataRegistry; + const childMapping = new Map(); + const typesWithChildren = Object.values(registry.types).filter((type) => type.children); + + typesWithChildren.map((parentType) => + Object.values(parentType.children.types).map((childType) => { + childMapping.set(childType.id, parentType.id); + }) + ); + + childMapping.forEach((parentId, childId) => { + it(`has a childType for ${childId} : ${parentId}`, () => { + expect(parentId).to.be.a('string'); + expect(childId).to.be.a('string'); + expect(registry.childTypes[childId]).to.equal(parentId); + }); + }); + }); +});