From 01e804e2ef221d13c45cd534cc472c5010111ed3 Mon Sep 17 00:00:00 2001 From: Eric Willhoit Date: Thu, 20 Mar 2025 15:51:00 -0500 Subject: [PATCH 1/3] feat: add test environment flag --- .gitignore | 2 ++ messages/create.md | 4 ++++ src/commands/create.ts | 5 +++++ test/ctc.nut.ts | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7adbb7f..951ee08 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,5 @@ node_modules # os specific files .DS_Store .idea + +test.sh \ No newline at end of file diff --git a/messages/create.md b/messages/create.md index 1c95fa2..2813394 100644 --- a/messages/create.md +++ b/messages/create.md @@ -9,3 +9,7 @@ change case template id # flags.configuration-item.summary Full path from the configuration item, ex: Salesforce.SF_Off_Core.DeveloperTools.NPM + +# flags.test-environment.summary + +Url to the test results for this change case. Will be added to the Change Case under "Automated Test Environment" (Test_Environment\_\_c) diff --git a/src/commands/create.ts b/src/commands/create.ts index b2a29e1..7c3ec36 100644 --- a/src/commands/create.ts +++ b/src/commands/create.ts @@ -76,6 +76,10 @@ export default class Create extends SfCommand { }), release: releaseFlag, location: locationFlag, + 'test-environment': Flags.string({ + summary: messages.getMessage('flags.test-environment.summary'), + required: false, + }), 'configuration-item': Flags.string({ summary: messages.getMessage('flags.configuration-item.summary'), required: true, @@ -185,6 +189,7 @@ export default class Create extends SfCommand { record.RecordTypeId = CHANGE_RECORD_TYPE_ID; record.SM_Source_Control_Location__c = this.flags.location?.toString() ?? (template.SM_Source_Control_Location__c as string); + record.Test_Environment__c = this.flags['test-environment'] ?? (template.Test_Environment__c as string); record.SM_Release__c = await retrieveOrCreateReleaseId( conn, new Ux({ jsonEnabled: this.jsonEnabled() }), diff --git a/test/ctc.nut.ts b/test/ctc.nut.ts index 4df478d..d02a218 100644 --- a/test/ctc.nut.ts +++ b/test/ctc.nut.ts @@ -97,7 +97,7 @@ describe('e2e', () => { let createResult: CreateResponse; it('create', () => { const result = execCmd( - `create --target-org ${session.hubOrg.username} --location ${repoUrl} --release ctc-nut --json`, + `create --target-org ${session.hubOrg.username} --location ${repoUrl} --test-environment ${repoUrl}/releases/tag/1.2.3 --release ctc-nut --json`, { ensureExitCode: 0 } ).jsonOutput?.result; assert(result); @@ -106,6 +106,7 @@ describe('e2e', () => { createResult = result!; expect(result?.id !== 'NOT PRESENT BECAUSE DRY RUN'); expect(result?.record.change.SM_Source_Control_Location__c).to.equal(repoUrl); + expect(result?.record.change.Test_Environment__c).to.equal(`${repoUrl}/releases/tag/1.2.3`); }); describe('close', () => { it('dryrun close by location/release (verifies works with only env)', () => { From 1a5975d979e9f00d25749308912037cd1b09b642 Mon Sep 17 00:00:00 2001 From: Eric Willhoit Date: Thu, 20 Mar 2025 16:00:20 -0500 Subject: [PATCH 2/3] chore: snapshot --- command-snapshot.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/command-snapshot.json b/command-snapshot.json index 6a028f4..5e3cd9c 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -20,7 +20,17 @@ "command": "create", "flagAliases": ["configurationitem", "dryrun", "targetusername", "templateid", "u"], "flagChars": ["c", "i", "l", "o", "r"], - "flags": ["configuration-item", "dry-run", "flags-dir", "json", "location", "release", "target-org", "template-id"], + "flags": [ + "configuration-item", + "dry-run", + "flags-dir", + "json", + "location", + "release", + "target-org", + "template-id", + "test-environment" + ], "plugin": "@salesforce/change-case-management" } ] From 3194ff02584b8660ea2d43a028d1d80ae226f102 Mon Sep 17 00:00:00 2001 From: Willhoit Date: Tue, 25 Mar 2025 11:00:07 -0500 Subject: [PATCH 3/3] chore: formating --- messages/create.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messages/create.md b/messages/create.md index 2813394..3d41f55 100644 --- a/messages/create.md +++ b/messages/create.md @@ -12,4 +12,4 @@ Full path from the configuration item, ex: Salesforce.SF_Off_Core.DeveloperTools # flags.test-environment.summary -Url to the test results for this change case. Will be added to the Change Case under "Automated Test Environment" (Test_Environment\_\_c) +Url to the test results for this change case. Will be added to the Change Case under "Automated Test Environment" (Test_Environment__c)