Skip to content

Commit 54b9efd

Browse files
authored
Sh/fix deploy sharing rules (#1419)
* fix: convert sharingRules by child * fix: correc the tests
1 parent f4db6ef commit 54b9efd

File tree

9 files changed

+4235
-37
lines changed

9 files changed

+4235
-37
lines changed

src/registry/metadataRegistry.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3984,10 +3984,10 @@
39843984
"sharingrules": {
39853985
"children": {
39863986
"directories": {
3987-
"sharingCriteriaRules": "sharingcriteriarule",
3988-
"sharingGuestRules": "sharingguestrule",
3989-
"sharingOwnerRules": "sharingownerrule",
3990-
"sharingTerritoryRules": "sharingterritoryrule"
3987+
"sharingCriteriaRules": "sharingRules",
3988+
"sharingGuestRules": "sharingRules",
3989+
"sharingOwnerRules": "sharingRules",
3990+
"sharingTerritoryRules": "sharingRules"
39913991
},
39923992
"suffixes": {
39933993
"sharingCriteriaRule": "sharingcriteriarule",
@@ -3997,31 +3997,31 @@
39973997
},
39983998
"types": {
39993999
"sharingcriteriarule": {
4000-
"directoryName": "sharingCriteriaRules",
4000+
"directoryName": "sharingRules",
40014001
"id": "sharingcriteriarule",
40024002
"name": "SharingCriteriaRule",
40034003
"suffix": "sharingCriteriaRule",
40044004
"uniqueIdElement": "fullName",
40054005
"xmlElementName": "sharingCriteriaRules"
40064006
},
40074007
"sharingguestrule": {
4008-
"directoryName": "sharingGuestRules",
4008+
"directoryName": "sharingRules",
40094009
"id": "sharingguestrule",
40104010
"name": "SharingGuestRule",
40114011
"suffix": "sharingGuestRule",
40124012
"uniqueIdElement": "fullName",
40134013
"xmlElementName": "sharingGuestRules"
40144014
},
40154015
"sharingownerrule": {
4016-
"directoryName": "sharingOwnerRules",
4016+
"directoryName": "sharingRules",
40174017
"id": "sharingownerrule",
40184018
"name": "SharingOwnerRule",
40194019
"suffix": "sharingOwnerRule",
40204020
"uniqueIdElement": "fullName",
40214021
"xmlElementName": "sharingOwnerRules"
40224022
},
40234023
"sharingterritoryrule": {
4024-
"directoryName": "sharingTerritoryRules",
4024+
"directoryName": "sharingRules",
40254025
"id": "sharingterritoryrule",
40264026
"name": "SharingTerritoryRule",
40274027
"suffix": "sharingTerritoryRule",

test/snapshot/sampleProjects/destructiveCompSets/snapshots.test.ts

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ describe('Creating and converting ComponentSets with destructive changes', () =>
5757
for (const file of convertedFiles) {
5858
await fileSnap(file, testDir);
5959
}
60-
dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'pre1'), pre1TestOutputDir);
60+
const expectedOutputDir = path.join(
61+
snapshotsDir,
62+
'1-pre-destructive-and-1-deployment.expected',
63+
'testOutput',
64+
'pre1'
65+
);
66+
await dirsAreIdentical(expectedOutputDir, pre1TestOutputDir);
6167
});
6268

6369
it('2 pre-destructive and 2 deployments', async () => {
@@ -82,7 +88,13 @@ describe('Creating and converting ComponentSets with destructive changes', () =>
8288
for (const file of convertedFiles) {
8389
await fileSnap(file, testDir);
8490
}
85-
dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'pre2'), pre2TestOutputDir);
91+
const expectedOutputDir = path.join(
92+
snapshotsDir,
93+
'2-pre-destructive-and-2-deployments.expected',
94+
'testOutput',
95+
'pre2'
96+
);
97+
await dirsAreIdentical(expectedOutputDir, pre2TestOutputDir);
8698
});
8799

88100
it('1 post-destructive and 1 deployment', async () => {
@@ -107,7 +119,13 @@ describe('Creating and converting ComponentSets with destructive changes', () =>
107119
for (const file of convertedFiles) {
108120
await fileSnap(file, testDir);
109121
}
110-
dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post1'), postTestOutputDir);
122+
const expectedOutputDir = path.join(
123+
snapshotsDir,
124+
'1-post-destructive-and-1-deployment.expected',
125+
'testOutput',
126+
'post1'
127+
);
128+
await dirsAreIdentical(expectedOutputDir, postTestOutputDir);
111129
});
112130

113131
it('2 post-destructive and 2 deployments', async () => {
@@ -132,7 +150,13 @@ describe('Creating and converting ComponentSets with destructive changes', () =>
132150
for (const file of convertedFiles) {
133151
await fileSnap(file, testDir);
134152
}
135-
dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post2'), post2TestOutputDir);
153+
const expectedOutputDir = path.join(
154+
snapshotsDir,
155+
'2-post-destructive-and-2-deployments.expected',
156+
'testOutput',
157+
'post2'
158+
);
159+
await dirsAreIdentical(expectedOutputDir, post2TestOutputDir);
136160
});
137161

138162
it('1 post-destructive and no deployment', async () => {
@@ -157,7 +181,13 @@ describe('Creating and converting ComponentSets with destructive changes', () =>
157181
for (const file of convertedFiles) {
158182
await fileSnap(file, testDir);
159183
}
160-
dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post1-solo'), postTestOutputDir);
184+
const expectedOutputDir = path.join(
185+
snapshotsDir,
186+
'1-post-destructive-and-no-deployment.expected',
187+
'testOutput',
188+
'post1-solo'
189+
);
190+
await dirsAreIdentical(expectedOutputDir, postTestOutputDir);
161191
});
162192

163193
it('throws when wildcards are used in destructive changes', async () => {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3+
<types>
4+
<members>account.AcctCBS_toAllInternal</members>
5+
<name>SharingCriteriaRule</name>
6+
</types>
7+
<version>52.0</version>
8+
</Package>

0 commit comments

Comments
 (0)