-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: move existing snapshot project
- Loading branch information
Showing
10 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...omposeLabels_Deprecated/__snapshots__/verify-md-files.expected/labels/CustomLabels.labels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<labels> | ||
<fullName>DeleteMe</fullName> | ||
<language>en_US</language> | ||
<protected>true</protected> | ||
<shortDescription>DeleteMe</shortDescription> | ||
<value>Test</value> | ||
</labels> | ||
<labels> | ||
<fullName>KeepMe1</fullName> | ||
<language>en_US</language> | ||
<protected>true</protected> | ||
<shortDescription>KeepMe1</shortDescription> | ||
<value>Test</value> | ||
</labels> | ||
<labels> | ||
<fullName>KeepMe2</fullName> | ||
<language>en_US</language> | ||
<protected>true</protected> | ||
<shortDescription>KeepMe2</shortDescription> | ||
<value>Test</value> | ||
</labels> | ||
</CustomLabels> |
8 changes: 8 additions & 0 deletions
8
...ects/preset-decomposeLabels_Deprecated/__snapshots__/verify-md-files.expected/package.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>CustomLabels</members> | ||
<name>CustomLabels</name> | ||
</types> | ||
<version>60.0</version> | ||
</Package> |
2 changes: 2 additions & 0 deletions
2
...ce-files.expected/force-app/main/default/labels/CustomLabels/CustomLabels.labels-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata"></CustomLabels> |
8 changes: 8 additions & 0 deletions
8
...-source-files.expected/force-app/main/default/labels/CustomLabels/DeleteMe.label-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomLabel xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<fullName>DeleteMe</fullName> | ||
<language>en_US</language> | ||
<protected>true</protected> | ||
<shortDescription>DeleteMe</shortDescription> | ||
<value>Test</value> | ||
</CustomLabel> |
8 changes: 8 additions & 0 deletions
8
...y-source-files.expected/force-app/main/default/labels/CustomLabels/KeepMe1.label-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomLabel xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<fullName>KeepMe1</fullName> | ||
<language>en_US</language> | ||
<protected>true</protected> | ||
<shortDescription>KeepMe1</shortDescription> | ||
<value>Test</value> | ||
</CustomLabel> |
8 changes: 8 additions & 0 deletions
8
...y-source-files.expected/force-app/main/default/labels/CustomLabels/KeepMe2.label-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomLabel xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<fullName>KeepMe2</fullName> | ||
<language>en_US</language> | ||
<protected>true</protected> | ||
<shortDescription>KeepMe2</shortDescription> | ||
<value>Test</value> | ||
</CustomLabel> |
24 changes: 24 additions & 0 deletions
24
...sampleProjects/preset-decomposeLabels_Deprecated/originalMdapi/labels/CustomLabels.labels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomLabels xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<labels> | ||
<fullName>DeleteMe</fullName> | ||
<language>en_US</language> | ||
<protected>true</protected> | ||
<shortDescription>DeleteMe</shortDescription> | ||
<value>Test</value> | ||
</labels> | ||
<labels> | ||
<fullName>KeepMe1</fullName> | ||
<language>en_US</language> | ||
<protected>true</protected> | ||
<shortDescription>KeepMe1</shortDescription> | ||
<value>Test</value> | ||
</labels> | ||
<labels> | ||
<fullName>KeepMe2</fullName> | ||
<language>en_US</language> | ||
<protected>true</protected> | ||
<shortDescription>KeepMe2</shortDescription> | ||
<value>Test</value> | ||
</labels> | ||
</CustomLabels> |
14 changes: 14 additions & 0 deletions
14
test/snapshot/sampleProjects/preset-decomposeLabels_Deprecated/originalMdapi/package.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Package xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<types> | ||
<members>DeleteMe</members> | ||
<members>KeepMe1</members> | ||
<members>KeepMe2</members> | ||
<name>CustomLabel</name> | ||
</types> | ||
<types> | ||
<members>CustomLabels</members> | ||
<name>CustomLabels</name> | ||
</types> | ||
<version>57.0</version> | ||
</Package> |
13 changes: 13 additions & 0 deletions
13
test/snapshot/sampleProjects/preset-decomposeLabels_Deprecated/sfdx-project.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "variantTest", | ||
"namespace": "", | ||
"packageDirectories": [ | ||
{ | ||
"default": true, | ||
"path": "force-app" | ||
} | ||
], | ||
"sourceBehaviorOptions": ["decomposeCustomLabelsBeta"], | ||
"sfdcLoginUrl": "https://login.salesforce.com", | ||
"sourceApiVersion": "60.0" | ||
} |
59 changes: 59 additions & 0 deletions
59
test/snapshot/sampleProjects/preset-decomposeLabels_Deprecated/snapshots.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (c) 2023, 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 * as fs from 'node:fs'; | ||
import * as path from 'node:path'; | ||
import { | ||
compareTwoXml, | ||
fileSnap, | ||
mdapiToSource, | ||
sourceToMdapi, | ||
MDAPI_OUT, | ||
dirsAreIdentical, | ||
FORCE_APP, | ||
} from '../../helper/conversions'; | ||
|
||
// we don't want failing tests outputting over each other | ||
/* eslint-disable no-await-in-loop */ | ||
|
||
describe('decomposed custom labels', () => { | ||
const testDir = path.join('test', 'snapshot', 'sampleProjects', 'preset-decomposeLabels_Deprecated'); | ||
let sourceFiles: string[]; | ||
let mdFiles: string[]; | ||
|
||
before(async () => { | ||
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) | ||
); | ||
}); | ||
it('verify md files', async () => { | ||
for (const file of mdFiles) { | ||
await fileSnap(file, testDir); | ||
} | ||
}); | ||
it('round trip of metadata format is equivalent', async () => { | ||
const [old, updated] = await Promise.all([ | ||
fs.promises.readFile(path.join(testDir, 'originalMdapi', 'labels', 'CustomLabels.labels'), 'utf8'), | ||
fs.promises.readFile(path.join(testDir, MDAPI_OUT, 'labels', 'CustomLabels.labels'), 'utf8'), | ||
]); | ||
compareTwoXml(old, updated); | ||
}); | ||
|
||
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 }), | ||
]); | ||
}); | ||
}); |