diff --git a/src/registry/metadataRegistry.json b/src/registry/metadataRegistry.json index aaba9a3207..9ad3e1e3f5 100644 --- a/src/registry/metadataRegistry.json +++ b/src/registry/metadataRegistry.json @@ -3984,10 +3984,10 @@ "sharingrules": { "children": { "directories": { - "sharingCriteriaRules": "sharingcriteriarule", - "sharingGuestRules": "sharingguestrule", - "sharingOwnerRules": "sharingownerrule", - "sharingTerritoryRules": "sharingterritoryrule" + "sharingCriteriaRules": "sharingRules", + "sharingGuestRules": "sharingRules", + "sharingOwnerRules": "sharingRules", + "sharingTerritoryRules": "sharingRules" }, "suffixes": { "sharingCriteriaRule": "sharingcriteriarule", @@ -3997,7 +3997,7 @@ }, "types": { "sharingcriteriarule": { - "directoryName": "sharingCriteriaRules", + "directoryName": "sharingRules", "id": "sharingcriteriarule", "name": "SharingCriteriaRule", "suffix": "sharingCriteriaRule", @@ -4005,7 +4005,7 @@ "xmlElementName": "sharingCriteriaRules" }, "sharingguestrule": { - "directoryName": "sharingGuestRules", + "directoryName": "sharingRules", "id": "sharingguestrule", "name": "SharingGuestRule", "suffix": "sharingGuestRule", @@ -4013,7 +4013,7 @@ "xmlElementName": "sharingGuestRules" }, "sharingownerrule": { - "directoryName": "sharingOwnerRules", + "directoryName": "sharingRules", "id": "sharingownerrule", "name": "SharingOwnerRule", "suffix": "sharingOwnerRule", @@ -4021,7 +4021,7 @@ "xmlElementName": "sharingOwnerRules" }, "sharingterritoryrule": { - "directoryName": "sharingTerritoryRules", + "directoryName": "sharingRules", "id": "sharingterritoryrule", "name": "SharingTerritoryRule", "suffix": "sharingTerritoryRule", diff --git a/test/snapshot/sampleProjects/destructiveCompSets/snapshots.test.ts b/test/snapshot/sampleProjects/destructiveCompSets/snapshots.test.ts index 547839cf86..0df5bf612a 100644 --- a/test/snapshot/sampleProjects/destructiveCompSets/snapshots.test.ts +++ b/test/snapshot/sampleProjects/destructiveCompSets/snapshots.test.ts @@ -57,7 +57,7 @@ describe('Creating and converting ComponentSets with destructive changes', () => for (const file of convertedFiles) { await fileSnap(file, testDir); } - dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'pre1'), pre1TestOutputDir); + await dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'pre1'), pre1TestOutputDir); }); it('2 pre-destructive and 2 deployments', async () => { @@ -82,7 +82,7 @@ describe('Creating and converting ComponentSets with destructive changes', () => for (const file of convertedFiles) { await fileSnap(file, testDir); } - dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'pre2'), pre2TestOutputDir); + await dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'pre2'), pre2TestOutputDir); }); it('1 post-destructive and 1 deployment', async () => { @@ -107,7 +107,7 @@ describe('Creating and converting ComponentSets with destructive changes', () => for (const file of convertedFiles) { await fileSnap(file, testDir); } - dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post1'), postTestOutputDir); + await dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post1'), postTestOutputDir); }); it('2 post-destructive and 2 deployments', async () => { @@ -132,7 +132,7 @@ describe('Creating and converting ComponentSets with destructive changes', () => for (const file of convertedFiles) { await fileSnap(file, testDir); } - dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post2'), post2TestOutputDir); + await dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post2'), post2TestOutputDir); }); it('1 post-destructive and no deployment', async () => { @@ -157,7 +157,7 @@ describe('Creating and converting ComponentSets with destructive changes', () => for (const file of convertedFiles) { await fileSnap(file, testDir); } - dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post1-solo'), postTestOutputDir); + await dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post1-solo'), postTestOutputDir); }); it('throws when wildcards are used in destructive changes', async () => { diff --git a/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SCR.expected/package.xml b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SCR.expected/package.xml new file mode 100644 index 0000000000..fd6211c1ee --- /dev/null +++ b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SCR.expected/package.xml @@ -0,0 +1,8 @@ + + + + account.AcctCBS_toAllInternal + SharingCriteriaRule + + 52.0 + diff --git a/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SCR.expected/sharingRules/account.sharingRules b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SCR.expected/sharingRules/account.sharingRules new file mode 100644 index 0000000000..829dce2508 --- /dev/null +++ b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SCR.expected/sharingRules/account.sharingRules @@ -0,0 +1,989 @@ + + + + AcctCBS2_toTerritory + Read + + None + Read + None + + + + Territory_1 + + + NumberOfEmployees + greaterThan + 200 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS2_toTerritories + Read + + None + Read + None + + + + Territory_1 + + + NumberOfEmployees + greaterThan + 200 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS_toAllCustPortal + Read + + None + Read + None + + + + + + + NumberOfEmployees + greaterThan + 100 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS_toAllInternal + Read + + None + Read + None + + cbs description + + + + + + Name + equals + Test + + + + AcctCBS_toAllPartner + Read + + None + Read + None + + + + + + + BillingCountry + equals + Japan + + + BillingCity + contains + Tokyo + + + + AcctCBS_toTerr + Read + + None + Read + None + + + + Territory_1 + + + AccountNumber + contains + 5 + + + + Acct_CBS_boolean + Read + + None + Read + None + + + + + + (1 AND 2) OR 3 + + IsExcludedFromRealign + equals + True + + + Name + contains + Boolean + + + ShippingCity + equals + Osaka + + + + criteria_group + Read + + None + Read + None + + + + Group2 + + + BillingCity + equals + Fremont + + + + criteria_groups + Read + + None + Read + None + + + + Group2 + + + BillingCity + equals + Fremont + + + + criteria_mgrSubs + Read + + None + Read + None + + + + CEO + + + Name + contains + Test + + + + criteria_mgrs + Read + + None + Read + None + + + + CEO + + + ShippingCountry + notEqual + France + + + + criteria_portal + Read + + None + Read + None + + + + ${portalRoleName} + + + Website + equals + www.salesforce.com + + + + criteria_portalAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + NumberOfEmployees + greaterThan + 100 + + + + criteria_role + Read + + None + Read + None + + + + role1 + + + NumberOfEmployees + lessThan + 1000 + + + + criteria_roles + Read + + None + Read + None + + + + role1 + + + NumberOfEmployees + lessThan + 1000 + + + + criteria_roleAndsubsPortal + Read + + None + Read + None + + + + ur1507245197985 + + + ShippingCountry + notEqual + Canada + + + + criteria_rolesAndsubsPortal + Read + + None + Read + None + + + + ur1507245197985 + + + ShippingCountry + notEqual + Canada + + + + criteria_roleandsubs + Read + + None + Read + None + + + + role1_sub_role + + + BillingCity + equals + Tokyo + + + + criteria_terrAndSubs + Read + + None + Read + None + + + + Territory_1 + + + BillingStreet + equals + Main + + + + criteria_terrsAndSubs + Read + + None + Read + None + + + + Territory_1 + + + BillingStreet + equals + Main + + + + AcctOwner_toCustPortal_fromInternal + Read + + None + Read + None + + + + + + + + + + + AcctOwner_toInteral_fromPartner + Read + + None + Read + None + + Account Owner Description + + + + + + + + + + AcctOwner_toPartner_fromCustomerPortal + Read + + None + Read + None + + + + + + + + + + + OwnerGroups + Read + + None + Read + None + + + + Group2 + + + Group1 + + + + OwnerGroups2 + Read + + None + Read + None + + + + Group2 + + + Group1 + + + + owner_FromTerrAndSub_ToTerr + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_FromTerrsAndSub_ToTerrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_ToTerrsAndSub_FromTerrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_fromPortalSubs_toPortal + Read + + None + Read + None + + + + ${portalRoleName} + + + ${portalRoleName} + + + + owner_fromTerrToTerrAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_fromportalRole_toAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + ${portalRoleName} + + + + owner_managerSubordinates + Read + + None + Read + None + + + + + + + + + + + owner_mgrs + Read + + None + Read + None + + + + + + + + + + + owner_role + Read + + None + Read + None + + + + ur1507245197985 + + + role1 + + + + owner_roles + Read + + None + Read + None + + + + ur1507245197985 + + + role1 + + + + owner_rolesIntAndPortal + Read + + None + Read + None + + + + ur1507245197985 + + + role1_sub_role + + + + owner_rolesIntAndPortal2 + Read + + None + Read + None + + + + ur1507245197985 + + + role1_sub_role + + + + owner_rolesIntSubs + Read + + None + Read + None + + + + role1_sub_role + + + role1 + + + + AcctTerr1_toAllInternal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr1s_toAllInternal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr_toAllCustPortal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr_toAllPartner + Read + + None + Read + None + + Account Territory Description + + + + + + Territory_1 + + + + Terr_Group + Read + + None + Read + None + + + + Group1 + + + Territory_1 + + + + Terr_Groups + Read + + None + Read + None + + + + Group1 + + + Territory_1 + + + + terrAndSubs_mgrSubs + Read + + None + Read + None + + + + + + + Territory_1 + + + + terr_mgrs + Read + + None + Read + None + + + + + + + Territory_1 + + + + terr_portalAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + Territory_1 + + + + terr_portalRole + Read + + None + Read + None + + + + ${portalRoleName} + + + Territory_1 + + + + terr_role + Read + + None + Read + None + + + + role1 + + + Territory_1 + + + + terr_roles + Read + + None + Read + None + + + + role1 + + + Territory_1 + + + + terr_roleAndSubPortal + Read + + None + Read + None + + + + ur1507245197985 + + + Territory_1 + + + + terr_rolesAndSubPortal + Read + + None + Read + None + + + + ur1507245197985 + + + Territory_1 + + + + terr_roleAndSubs + Read + + None + Read + None + + + + role1_sub_role + + + Territory_1 + + + + terr_terr + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrsAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + \ No newline at end of file diff --git a/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SR.expected/package.xml b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SR.expected/package.xml new file mode 100644 index 0000000000..cea14eeef9 --- /dev/null +++ b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SR.expected/package.xml @@ -0,0 +1,74 @@ + + + + account.AcctCBS2_toTerritories + account.AcctCBS2_toTerritory + account.AcctCBS_toAllCustPortal + account.AcctCBS_toAllInternal + account.AcctCBS_toAllPartner + account.AcctCBS_toTerr + account.Acct_CBS_boolean + account.criteria_group + account.criteria_groups + account.criteria_mgrSubs + account.criteria_mgrs + account.criteria_portal + account.criteria_portalAndSubs + account.criteria_role + account.criteria_roleAndsubsPortal + account.criteria_roleandsubs + account.criteria_roles + account.criteria_rolesAndsubsPortal + account.criteria_terrAndSubs + account.criteria_terrsAndSubs + SharingCriteriaRule + + + account.AcctOwner_toCustPortal_fromInternal + account.AcctOwner_toInteral_fromPartner + account.AcctOwner_toPartner_fromCustomerPortal + account.OwnerGroups + account.OwnerGroups2 + account.owner_FromTerrAndSub_ToTerr + account.owner_FromTerrsAndSub_ToTerrs + account.owner_ToTerrsAndSub_FromTerrs + account.owner_fromPortalSubs_toPortal + account.owner_fromTerrToTerrAndSub + account.owner_fromportalRole_toAndSubs + account.owner_managerSubordinates + account.owner_mgrs + account.owner_role + account.owner_roles + account.owner_rolesIntAndPortal + account.owner_rolesIntAndPortal2 + account.owner_rolesIntSubs + SharingOwnerRule + + + account + SharingRules + + + account.AcctTerr1_toAllInternal + account.AcctTerr1s_toAllInternal + account.AcctTerr_toAllCustPortal + account.AcctTerr_toAllPartner + account.Terr_Group + account.Terr_Groups + account.terrAndSubs_mgrSubs + account.terr_mgrs + account.terr_portalAndSubs + account.terr_portalRole + account.terr_role + account.terr_roleAndSubPortal + account.terr_roleAndSubs + account.terr_roles + account.terr_rolesAndSubPortal + account.terr_terr + account.terr_terrAndSub + account.terr_terrs + account.terr_terrsAndSub + SharingTerritoryRule + + 52.0 + diff --git a/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SR.expected/sharingRules/account.sharingRules b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SR.expected/sharingRules/account.sharingRules new file mode 100644 index 0000000000..829dce2508 --- /dev/null +++ b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-md-files-SR.expected/sharingRules/account.sharingRules @@ -0,0 +1,989 @@ + + + + AcctCBS2_toTerritory + Read + + None + Read + None + + + + Territory_1 + + + NumberOfEmployees + greaterThan + 200 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS2_toTerritories + Read + + None + Read + None + + + + Territory_1 + + + NumberOfEmployees + greaterThan + 200 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS_toAllCustPortal + Read + + None + Read + None + + + + + + + NumberOfEmployees + greaterThan + 100 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS_toAllInternal + Read + + None + Read + None + + cbs description + + + + + + Name + equals + Test + + + + AcctCBS_toAllPartner + Read + + None + Read + None + + + + + + + BillingCountry + equals + Japan + + + BillingCity + contains + Tokyo + + + + AcctCBS_toTerr + Read + + None + Read + None + + + + Territory_1 + + + AccountNumber + contains + 5 + + + + Acct_CBS_boolean + Read + + None + Read + None + + + + + + (1 AND 2) OR 3 + + IsExcludedFromRealign + equals + True + + + Name + contains + Boolean + + + ShippingCity + equals + Osaka + + + + criteria_group + Read + + None + Read + None + + + + Group2 + + + BillingCity + equals + Fremont + + + + criteria_groups + Read + + None + Read + None + + + + Group2 + + + BillingCity + equals + Fremont + + + + criteria_mgrSubs + Read + + None + Read + None + + + + CEO + + + Name + contains + Test + + + + criteria_mgrs + Read + + None + Read + None + + + + CEO + + + ShippingCountry + notEqual + France + + + + criteria_portal + Read + + None + Read + None + + + + ${portalRoleName} + + + Website + equals + www.salesforce.com + + + + criteria_portalAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + NumberOfEmployees + greaterThan + 100 + + + + criteria_role + Read + + None + Read + None + + + + role1 + + + NumberOfEmployees + lessThan + 1000 + + + + criteria_roles + Read + + None + Read + None + + + + role1 + + + NumberOfEmployees + lessThan + 1000 + + + + criteria_roleAndsubsPortal + Read + + None + Read + None + + + + ur1507245197985 + + + ShippingCountry + notEqual + Canada + + + + criteria_rolesAndsubsPortal + Read + + None + Read + None + + + + ur1507245197985 + + + ShippingCountry + notEqual + Canada + + + + criteria_roleandsubs + Read + + None + Read + None + + + + role1_sub_role + + + BillingCity + equals + Tokyo + + + + criteria_terrAndSubs + Read + + None + Read + None + + + + Territory_1 + + + BillingStreet + equals + Main + + + + criteria_terrsAndSubs + Read + + None + Read + None + + + + Territory_1 + + + BillingStreet + equals + Main + + + + AcctOwner_toCustPortal_fromInternal + Read + + None + Read + None + + + + + + + + + + + AcctOwner_toInteral_fromPartner + Read + + None + Read + None + + Account Owner Description + + + + + + + + + + AcctOwner_toPartner_fromCustomerPortal + Read + + None + Read + None + + + + + + + + + + + OwnerGroups + Read + + None + Read + None + + + + Group2 + + + Group1 + + + + OwnerGroups2 + Read + + None + Read + None + + + + Group2 + + + Group1 + + + + owner_FromTerrAndSub_ToTerr + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_FromTerrsAndSub_ToTerrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_ToTerrsAndSub_FromTerrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_fromPortalSubs_toPortal + Read + + None + Read + None + + + + ${portalRoleName} + + + ${portalRoleName} + + + + owner_fromTerrToTerrAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_fromportalRole_toAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + ${portalRoleName} + + + + owner_managerSubordinates + Read + + None + Read + None + + + + + + + + + + + owner_mgrs + Read + + None + Read + None + + + + + + + + + + + owner_role + Read + + None + Read + None + + + + ur1507245197985 + + + role1 + + + + owner_roles + Read + + None + Read + None + + + + ur1507245197985 + + + role1 + + + + owner_rolesIntAndPortal + Read + + None + Read + None + + + + ur1507245197985 + + + role1_sub_role + + + + owner_rolesIntAndPortal2 + Read + + None + Read + None + + + + ur1507245197985 + + + role1_sub_role + + + + owner_rolesIntSubs + Read + + None + Read + None + + + + role1_sub_role + + + role1 + + + + AcctTerr1_toAllInternal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr1s_toAllInternal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr_toAllCustPortal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr_toAllPartner + Read + + None + Read + None + + Account Territory Description + + + + + + Territory_1 + + + + Terr_Group + Read + + None + Read + None + + + + Group1 + + + Territory_1 + + + + Terr_Groups + Read + + None + Read + None + + + + Group1 + + + Territory_1 + + + + terrAndSubs_mgrSubs + Read + + None + Read + None + + + + + + + Territory_1 + + + + terr_mgrs + Read + + None + Read + None + + + + + + + Territory_1 + + + + terr_portalAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + Territory_1 + + + + terr_portalRole + Read + + None + Read + None + + + + ${portalRoleName} + + + Territory_1 + + + + terr_role + Read + + None + Read + None + + + + role1 + + + Territory_1 + + + + terr_roles + Read + + None + Read + None + + + + role1 + + + Territory_1 + + + + terr_roleAndSubPortal + Read + + None + Read + None + + + + ur1507245197985 + + + Territory_1 + + + + terr_rolesAndSubPortal + Read + + None + Read + None + + + + ur1507245197985 + + + Territory_1 + + + + terr_roleAndSubs + Read + + None + Read + None + + + + role1_sub_role + + + Territory_1 + + + + terr_terr + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrsAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + \ No newline at end of file diff --git a/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-source-files-SCR.expected/force-app/main/default/sharingRules/account.sharingRules-meta.xml b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-source-files-SCR.expected/force-app/main/default/sharingRules/account.sharingRules-meta.xml new file mode 100644 index 0000000000..829dce2508 --- /dev/null +++ b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-source-files-SCR.expected/force-app/main/default/sharingRules/account.sharingRules-meta.xml @@ -0,0 +1,989 @@ + + + + AcctCBS2_toTerritory + Read + + None + Read + None + + + + Territory_1 + + + NumberOfEmployees + greaterThan + 200 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS2_toTerritories + Read + + None + Read + None + + + + Territory_1 + + + NumberOfEmployees + greaterThan + 200 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS_toAllCustPortal + Read + + None + Read + None + + + + + + + NumberOfEmployees + greaterThan + 100 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS_toAllInternal + Read + + None + Read + None + + cbs description + + + + + + Name + equals + Test + + + + AcctCBS_toAllPartner + Read + + None + Read + None + + + + + + + BillingCountry + equals + Japan + + + BillingCity + contains + Tokyo + + + + AcctCBS_toTerr + Read + + None + Read + None + + + + Territory_1 + + + AccountNumber + contains + 5 + + + + Acct_CBS_boolean + Read + + None + Read + None + + + + + + (1 AND 2) OR 3 + + IsExcludedFromRealign + equals + True + + + Name + contains + Boolean + + + ShippingCity + equals + Osaka + + + + criteria_group + Read + + None + Read + None + + + + Group2 + + + BillingCity + equals + Fremont + + + + criteria_groups + Read + + None + Read + None + + + + Group2 + + + BillingCity + equals + Fremont + + + + criteria_mgrSubs + Read + + None + Read + None + + + + CEO + + + Name + contains + Test + + + + criteria_mgrs + Read + + None + Read + None + + + + CEO + + + ShippingCountry + notEqual + France + + + + criteria_portal + Read + + None + Read + None + + + + ${portalRoleName} + + + Website + equals + www.salesforce.com + + + + criteria_portalAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + NumberOfEmployees + greaterThan + 100 + + + + criteria_role + Read + + None + Read + None + + + + role1 + + + NumberOfEmployees + lessThan + 1000 + + + + criteria_roles + Read + + None + Read + None + + + + role1 + + + NumberOfEmployees + lessThan + 1000 + + + + criteria_roleAndsubsPortal + Read + + None + Read + None + + + + ur1507245197985 + + + ShippingCountry + notEqual + Canada + + + + criteria_rolesAndsubsPortal + Read + + None + Read + None + + + + ur1507245197985 + + + ShippingCountry + notEqual + Canada + + + + criteria_roleandsubs + Read + + None + Read + None + + + + role1_sub_role + + + BillingCity + equals + Tokyo + + + + criteria_terrAndSubs + Read + + None + Read + None + + + + Territory_1 + + + BillingStreet + equals + Main + + + + criteria_terrsAndSubs + Read + + None + Read + None + + + + Territory_1 + + + BillingStreet + equals + Main + + + + AcctOwner_toCustPortal_fromInternal + Read + + None + Read + None + + + + + + + + + + + AcctOwner_toInteral_fromPartner + Read + + None + Read + None + + Account Owner Description + + + + + + + + + + AcctOwner_toPartner_fromCustomerPortal + Read + + None + Read + None + + + + + + + + + + + OwnerGroups + Read + + None + Read + None + + + + Group2 + + + Group1 + + + + OwnerGroups2 + Read + + None + Read + None + + + + Group2 + + + Group1 + + + + owner_FromTerrAndSub_ToTerr + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_FromTerrsAndSub_ToTerrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_ToTerrsAndSub_FromTerrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_fromPortalSubs_toPortal + Read + + None + Read + None + + + + ${portalRoleName} + + + ${portalRoleName} + + + + owner_fromTerrToTerrAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_fromportalRole_toAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + ${portalRoleName} + + + + owner_managerSubordinates + Read + + None + Read + None + + + + + + + + + + + owner_mgrs + Read + + None + Read + None + + + + + + + + + + + owner_role + Read + + None + Read + None + + + + ur1507245197985 + + + role1 + + + + owner_roles + Read + + None + Read + None + + + + ur1507245197985 + + + role1 + + + + owner_rolesIntAndPortal + Read + + None + Read + None + + + + ur1507245197985 + + + role1_sub_role + + + + owner_rolesIntAndPortal2 + Read + + None + Read + None + + + + ur1507245197985 + + + role1_sub_role + + + + owner_rolesIntSubs + Read + + None + Read + None + + + + role1_sub_role + + + role1 + + + + AcctTerr1_toAllInternal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr1s_toAllInternal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr_toAllCustPortal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr_toAllPartner + Read + + None + Read + None + + Account Territory Description + + + + + + Territory_1 + + + + Terr_Group + Read + + None + Read + None + + + + Group1 + + + Territory_1 + + + + Terr_Groups + Read + + None + Read + None + + + + Group1 + + + Territory_1 + + + + terrAndSubs_mgrSubs + Read + + None + Read + None + + + + + + + Territory_1 + + + + terr_mgrs + Read + + None + Read + None + + + + + + + Territory_1 + + + + terr_portalAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + Territory_1 + + + + terr_portalRole + Read + + None + Read + None + + + + ${portalRoleName} + + + Territory_1 + + + + terr_role + Read + + None + Read + None + + + + role1 + + + Territory_1 + + + + terr_roles + Read + + None + Read + None + + + + role1 + + + Territory_1 + + + + terr_roleAndSubPortal + Read + + None + Read + None + + + + ur1507245197985 + + + Territory_1 + + + + terr_rolesAndSubPortal + Read + + None + Read + None + + + + ur1507245197985 + + + Territory_1 + + + + terr_roleAndSubs + Read + + None + Read + None + + + + role1_sub_role + + + Territory_1 + + + + terr_terr + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrsAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + \ No newline at end of file diff --git a/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-source-files-SR.expected/force-app/main/default/sharingRules/account.sharingRules-meta.xml b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-source-files-SR.expected/force-app/main/default/sharingRules/account.sharingRules-meta.xml new file mode 100644 index 0000000000..829dce2508 --- /dev/null +++ b/test/snapshot/sampleProjects/sharingRules/__snapshots__/verify-source-files-SR.expected/force-app/main/default/sharingRules/account.sharingRules-meta.xml @@ -0,0 +1,989 @@ + + + + AcctCBS2_toTerritory + Read + + None + Read + None + + + + Territory_1 + + + NumberOfEmployees + greaterThan + 200 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS2_toTerritories + Read + + None + Read + None + + + + Territory_1 + + + NumberOfEmployees + greaterThan + 200 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS_toAllCustPortal + Read + + None + Read + None + + + + + + + NumberOfEmployees + greaterThan + 100 + + + BillingCity + notEqual + San Francisco + + + + AcctCBS_toAllInternal + Read + + None + Read + None + + cbs description + + + + + + Name + equals + Test + + + + AcctCBS_toAllPartner + Read + + None + Read + None + + + + + + + BillingCountry + equals + Japan + + + BillingCity + contains + Tokyo + + + + AcctCBS_toTerr + Read + + None + Read + None + + + + Territory_1 + + + AccountNumber + contains + 5 + + + + Acct_CBS_boolean + Read + + None + Read + None + + + + + + (1 AND 2) OR 3 + + IsExcludedFromRealign + equals + True + + + Name + contains + Boolean + + + ShippingCity + equals + Osaka + + + + criteria_group + Read + + None + Read + None + + + + Group2 + + + BillingCity + equals + Fremont + + + + criteria_groups + Read + + None + Read + None + + + + Group2 + + + BillingCity + equals + Fremont + + + + criteria_mgrSubs + Read + + None + Read + None + + + + CEO + + + Name + contains + Test + + + + criteria_mgrs + Read + + None + Read + None + + + + CEO + + + ShippingCountry + notEqual + France + + + + criteria_portal + Read + + None + Read + None + + + + ${portalRoleName} + + + Website + equals + www.salesforce.com + + + + criteria_portalAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + NumberOfEmployees + greaterThan + 100 + + + + criteria_role + Read + + None + Read + None + + + + role1 + + + NumberOfEmployees + lessThan + 1000 + + + + criteria_roles + Read + + None + Read + None + + + + role1 + + + NumberOfEmployees + lessThan + 1000 + + + + criteria_roleAndsubsPortal + Read + + None + Read + None + + + + ur1507245197985 + + + ShippingCountry + notEqual + Canada + + + + criteria_rolesAndsubsPortal + Read + + None + Read + None + + + + ur1507245197985 + + + ShippingCountry + notEqual + Canada + + + + criteria_roleandsubs + Read + + None + Read + None + + + + role1_sub_role + + + BillingCity + equals + Tokyo + + + + criteria_terrAndSubs + Read + + None + Read + None + + + + Territory_1 + + + BillingStreet + equals + Main + + + + criteria_terrsAndSubs + Read + + None + Read + None + + + + Territory_1 + + + BillingStreet + equals + Main + + + + AcctOwner_toCustPortal_fromInternal + Read + + None + Read + None + + + + + + + + + + + AcctOwner_toInteral_fromPartner + Read + + None + Read + None + + Account Owner Description + + + + + + + + + + AcctOwner_toPartner_fromCustomerPortal + Read + + None + Read + None + + + + + + + + + + + OwnerGroups + Read + + None + Read + None + + + + Group2 + + + Group1 + + + + OwnerGroups2 + Read + + None + Read + None + + + + Group2 + + + Group1 + + + + owner_FromTerrAndSub_ToTerr + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_FromTerrsAndSub_ToTerrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_ToTerrsAndSub_FromTerrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_fromPortalSubs_toPortal + Read + + None + Read + None + + + + ${portalRoleName} + + + ${portalRoleName} + + + + owner_fromTerrToTerrAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + owner_fromportalRole_toAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + ${portalRoleName} + + + + owner_managerSubordinates + Read + + None + Read + None + + + + + + + + + + + owner_mgrs + Read + + None + Read + None + + + + + + + + + + + owner_role + Read + + None + Read + None + + + + ur1507245197985 + + + role1 + + + + owner_roles + Read + + None + Read + None + + + + ur1507245197985 + + + role1 + + + + owner_rolesIntAndPortal + Read + + None + Read + None + + + + ur1507245197985 + + + role1_sub_role + + + + owner_rolesIntAndPortal2 + Read + + None + Read + None + + + + ur1507245197985 + + + role1_sub_role + + + + owner_rolesIntSubs + Read + + None + Read + None + + + + role1_sub_role + + + role1 + + + + AcctTerr1_toAllInternal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr1s_toAllInternal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr_toAllCustPortal + Read + + None + Read + None + + + + + + + Territory_1 + + + + AcctTerr_toAllPartner + Read + + None + Read + None + + Account Territory Description + + + + + + Territory_1 + + + + Terr_Group + Read + + None + Read + None + + + + Group1 + + + Territory_1 + + + + Terr_Groups + Read + + None + Read + None + + + + Group1 + + + Territory_1 + + + + terrAndSubs_mgrSubs + Read + + None + Read + None + + + + + + + Territory_1 + + + + terr_mgrs + Read + + None + Read + None + + + + + + + Territory_1 + + + + terr_portalAndSubs + Read + + None + Read + None + + + + ${portalRoleName} + + + Territory_1 + + + + terr_portalRole + Read + + None + Read + None + + + + ${portalRoleName} + + + Territory_1 + + + + terr_role + Read + + None + Read + None + + + + role1 + + + Territory_1 + + + + terr_roles + Read + + None + Read + None + + + + role1 + + + Territory_1 + + + + terr_roleAndSubPortal + Read + + None + Read + None + + + + ur1507245197985 + + + Territory_1 + + + + terr_rolesAndSubPortal + Read + + None + Read + None + + + + ur1507245197985 + + + Territory_1 + + + + terr_roleAndSubs + Read + + None + Read + None + + + + role1_sub_role + + + Territory_1 + + + + terr_terr + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrs + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + + terr_terrsAndSub + Read + + None + Read + None + + + + Territory_1 + + + Territory_1 + + + \ No newline at end of file diff --git a/test/snapshot/sampleProjects/sharingRules/snapshots.test.ts b/test/snapshot/sampleProjects/sharingRules/snapshots.test.ts index 6f206f0d34..84ebd823d2 100644 --- a/test/snapshot/sampleProjects/sharingRules/snapshots.test.ts +++ b/test/snapshot/sampleProjects/sharingRules/snapshots.test.ts @@ -10,43 +10,173 @@ import { FORCE_APP, MDAPI_OUT, dirsAreIdentical, + dirEntsToPaths, fileSnap, mdapiToSource, sourceToMdapi, } from '../../helper/conversions'; +import { MetadataConverter } from '../../../../src/convert/metadataConverter'; +import { ComponentSetBuilder } from '../../../../src/collections/componentSetBuilder'; // we don't want failing tests outputting over each other /* eslint-disable no-await-in-loop */ -describe('Sharing Rules!', () => { +describe('Sharing Rules', () => { const testDir = path.join('test', 'snapshot', 'sampleProjects', 'sharingRules'); - let sourceFiles: string[]; - let mdFiles: string[]; - before(async () => { - await fs.promises.mkdir(path.join(testDir, FORCE_APP), { recursive: true }); - sourceFiles = await mdapiToSource(testDir); - mdFiles = await sourceToMdapi(testDir); - }); - it('verify source files', async () => { - for (const file of sourceFiles) { - await fileSnap(file, testDir); - } - dirsAreIdentical( - path.join(testDir, FORCE_APP), - path.join(testDir, '__snapshots__', 'verify-source-files.expected', FORCE_APP) + // The directory of snapshots containing expected conversion results + const snapshotsDir = path.join(testDir, '__snapshots__'); + + /** Return only the files involved in the conversion */ + const getConvertedFilePaths = async (outputDir: string): Promise => + dirEntsToPaths( + await fs.promises.readdir(outputDir, { + recursive: true, + withFileTypes: true, + }) ); + + describe('convert entire project by path', () => { + let sourceFiles: string[]; + let mdFiles: string[]; + + before(async () => { + sourceFiles = await mdapiToSource(testDir); + mdFiles = await sourceToMdapi(testDir); + }); + after(async () => { + await Promise.all([ + fs.promises.rm(path.join(testDir, FORCE_APP), { recursive: true, force: true }), + fs.promises.rm(path.join(testDir, MDAPI_OUT), { recursive: true, force: true }), + ]); + }); + + it('verify source files', async () => { + for (const file of sourceFiles) { + await fileSnap(file, testDir); + } + dirsAreIdentical( + path.join(testDir, FORCE_APP), + path.join(testDir, '__snapshots__', 'verify-source-files.expected', FORCE_APP) + ); + }); + + it('verify md files', async () => { + for (const file of mdFiles) { + await fileSnap(file, testDir); + } + }); }); - it('verify md files', async () => { - for (const file of mdFiles) { - await fileSnap(file, testDir); - } + + describe('convert SharingRules by SharingCriteriaRule type', () => { + afterEach(async () => { + await Promise.all([ + fs.promises.rm(path.join(testDir, FORCE_APP), { recursive: true, force: true }), + fs.promises.rm(path.join(testDir, MDAPI_OUT), { recursive: true, force: true }), + ]); + }); + it('verify source files SCR', async () => { + // Use expected md files as the project to convert to source format + const projectMdDir = path.join(snapshotsDir, 'verify-md-files.expected'); + const cs = await ComponentSetBuilder.build({ + metadata: { + metadataEntries: ['SharingCriteriaRule:account.AcctCBS_toAllInternal'], + directoryPaths: [projectMdDir], + }, + projectDir: testDir, + }); + const convertOutputDir = path.join(testDir, FORCE_APP); + await new MetadataConverter().convert(cs, 'source', { + type: 'directory', + outputDirectory: convertOutputDir, + genUniqueDir: false, + }); + const convertedFiles = await getConvertedFilePaths(convertOutputDir); + for (const file of convertedFiles) { + await fileSnap(file, testDir); + } + const expectedConvertDir = path.join(snapshotsDir, 'verify-source-files-SCR.expected', 'force-app'); + await dirsAreIdentical(convertOutputDir, expectedConvertDir); + }); + it('verify md files SCR', async () => { + // Use expected source files as the project to convert to mdapi format + const projectSrcDir = path.join(snapshotsDir, 'verify-source-files.expected', 'force-app'); + const cs = await ComponentSetBuilder.build({ + metadata: { + metadataEntries: ['SharingCriteriaRule:account.AcctCBS_toAllInternal'], + directoryPaths: [projectSrcDir], + }, + projectDir: testDir, + }); + const convertOutputDir = path.join(testDir, MDAPI_OUT); + await new MetadataConverter().convert(cs, 'metadata', { + type: 'directory', + outputDirectory: convertOutputDir, + genUniqueDir: false, + }); + + const convertedFiles = await getConvertedFilePaths(convertOutputDir); + for (const file of convertedFiles) { + await fileSnap(file, testDir); + } + const expectedConvertDir = path.join(snapshotsDir, 'verify-md-files-SCR.expected'); + await dirsAreIdentical(convertOutputDir, expectedConvertDir); + }); }); - after(async () => { - await Promise.all([ - fs.promises.rm(path.join(testDir, FORCE_APP), { recursive: true, force: true }), - fs.promises.rm(path.join(testDir, MDAPI_OUT), { recursive: true, force: true }), - ]); + describe('convert SharingRules by SharingRules type', () => { + afterEach(async () => { + await Promise.all([ + fs.promises.rm(path.join(testDir, FORCE_APP), { recursive: true, force: true }), + fs.promises.rm(path.join(testDir, MDAPI_OUT), { recursive: true, force: true }), + ]); + }); + it('verify source files SR', async () => { + // Use expected md files as the project to convert to source format + const projectMdDir = path.join(snapshotsDir, 'verify-md-files.expected'); + const cs = await ComponentSetBuilder.build({ + metadata: { + metadataEntries: ['SharingRules:account'], + directoryPaths: [projectMdDir], + }, + projectDir: testDir, + }); + const convertOutputDir = path.join(testDir, FORCE_APP); + await new MetadataConverter().convert(cs, 'source', { + type: 'directory', + outputDirectory: convertOutputDir, + genUniqueDir: false, + }); + const convertedFiles = await getConvertedFilePaths(convertOutputDir); + for (const file of convertedFiles) { + await fileSnap(file, testDir); + } + const expectedConvertDir = path.join(snapshotsDir, 'verify-source-files-SR.expected', 'force-app'); + await dirsAreIdentical(convertOutputDir, expectedConvertDir); + }); + it('verify md files SR', async () => { + // Use expected source files as the project to convert to mdapi format + const projectSrcDir = path.join(snapshotsDir, 'verify-source-files.expected', 'force-app'); + const cs = await ComponentSetBuilder.build({ + metadata: { + metadataEntries: ['SharingRules:account'], + directoryPaths: [projectSrcDir], + }, + projectDir: testDir, + }); + const convertOutputDir = path.join(testDir, MDAPI_OUT); + await new MetadataConverter().convert(cs, 'metadata', { + type: 'directory', + outputDirectory: convertOutputDir, + genUniqueDir: false, + }); + + const convertedFiles = await getConvertedFilePaths(convertOutputDir); + for (const file of convertedFiles) { + await fileSnap(file, testDir); + } + const expectedConvertDir = path.join(snapshotsDir, 'verify-md-files-SR.expected'); + await dirsAreIdentical(convertOutputDir, expectedConvertDir); + }); }); });