Skip to content

Commit

Permalink
Sh/fix deploy sharing rules (#1419)
Browse files Browse the repository at this point in the history
* fix: convert sharingRules by child

* fix: correc the tests
  • Loading branch information
shetzel authored Sep 13, 2024
1 parent f4db6ef commit 54b9efd
Show file tree
Hide file tree
Showing 9 changed files with 4,235 additions and 37 deletions.
16 changes: 8 additions & 8 deletions src/registry/metadataRegistry.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -3997,31 +3997,31 @@
},
"types": {
"sharingcriteriarule": {
"directoryName": "sharingCriteriaRules",
"directoryName": "sharingRules",
"id": "sharingcriteriarule",
"name": "SharingCriteriaRule",
"suffix": "sharingCriteriaRule",
"uniqueIdElement": "fullName",
"xmlElementName": "sharingCriteriaRules"
},
"sharingguestrule": {
"directoryName": "sharingGuestRules",
"directoryName": "sharingRules",
"id": "sharingguestrule",
"name": "SharingGuestRule",
"suffix": "sharingGuestRule",
"uniqueIdElement": "fullName",
"xmlElementName": "sharingGuestRules"
},
"sharingownerrule": {
"directoryName": "sharingOwnerRules",
"directoryName": "sharingRules",
"id": "sharingownerrule",
"name": "SharingOwnerRule",
"suffix": "sharingOwnerRule",
"uniqueIdElement": "fullName",
"xmlElementName": "sharingOwnerRules"
},
"sharingterritoryrule": {
"directoryName": "sharingTerritoryRules",
"directoryName": "sharingRules",
"id": "sharingterritoryrule",
"name": "SharingTerritoryRule",
"suffix": "sharingTerritoryRule",
Expand Down
40 changes: 35 additions & 5 deletions test/snapshot/sampleProjects/destructiveCompSets/snapshots.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ describe('Creating and converting ComponentSets with destructive changes', () =>
for (const file of convertedFiles) {
await fileSnap(file, testDir);
}
dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'pre1'), pre1TestOutputDir);
const expectedOutputDir = path.join(
snapshotsDir,
'1-pre-destructive-and-1-deployment.expected',
'testOutput',
'pre1'
);
await dirsAreIdentical(expectedOutputDir, pre1TestOutputDir);
});

it('2 pre-destructive and 2 deployments', async () => {
Expand All @@ -82,7 +88,13 @@ describe('Creating and converting ComponentSets with destructive changes', () =>
for (const file of convertedFiles) {
await fileSnap(file, testDir);
}
dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'pre2'), pre2TestOutputDir);
const expectedOutputDir = path.join(
snapshotsDir,
'2-pre-destructive-and-2-deployments.expected',
'testOutput',
'pre2'
);
await dirsAreIdentical(expectedOutputDir, pre2TestOutputDir);
});

it('1 post-destructive and 1 deployment', async () => {
Expand All @@ -107,7 +119,13 @@ describe('Creating and converting ComponentSets with destructive changes', () =>
for (const file of convertedFiles) {
await fileSnap(file, testDir);
}
dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post1'), postTestOutputDir);
const expectedOutputDir = path.join(
snapshotsDir,
'1-post-destructive-and-1-deployment.expected',
'testOutput',
'post1'
);
await dirsAreIdentical(expectedOutputDir, postTestOutputDir);
});

it('2 post-destructive and 2 deployments', async () => {
Expand All @@ -132,7 +150,13 @@ describe('Creating and converting ComponentSets with destructive changes', () =>
for (const file of convertedFiles) {
await fileSnap(file, testDir);
}
dirsAreIdentical(path.join(snapshotsDir, 'testOutput', 'post2'), post2TestOutputDir);
const expectedOutputDir = path.join(
snapshotsDir,
'2-post-destructive-and-2-deployments.expected',
'testOutput',
'post2'
);
await dirsAreIdentical(expectedOutputDir, post2TestOutputDir);
});

it('1 post-destructive and no deployment', async () => {
Expand All @@ -157,7 +181,13 @@ 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);
const expectedOutputDir = path.join(
snapshotsDir,
'1-post-destructive-and-no-deployment.expected',
'testOutput',
'post1-solo'
);
await dirsAreIdentical(expectedOutputDir, postTestOutputDir);
});

it('throws when wildcards are used in destructive changes', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>account.AcctCBS_toAllInternal</members>
<name>SharingCriteriaRule</name>
</types>
<version>52.0</version>
</Package>
Loading

0 comments on commit 54b9efd

Please sign in to comment.