|
7 | 7 | import fs from 'node:fs'; |
8 | 8 | import path from 'node:path'; |
9 | 9 |
|
| 10 | +import { parseJsonMap } from '@salesforce/kit'; |
10 | 11 | import { execCmd, genUniqueString, TestSession } from '@salesforce/cli-plugins-testkit'; |
11 | 12 | import { assert, expect } from 'chai'; |
12 | 13 | import { AuthFields, Messages, Global, StateAggregator } from '@salesforce/core'; |
@@ -64,6 +65,39 @@ describe('env create scratch NUTs', () => { |
64 | 65 | describe('successes', () => { |
65 | 66 | const keys = ['username', 'orgId', 'scratchOrgInfo', 'authFields', 'warnings']; |
66 | 67 |
|
| 68 | + it('creates an org with capitalized record types', async () => { |
| 69 | + const scratchDefJson = parseJsonMap( |
| 70 | + await fs.promises.readFile(path.join(session.project.dir, 'config', 'project-scratch-def.json'), 'utf8') |
| 71 | + ); |
| 72 | + scratchDefJson.objectSettings = { |
| 73 | + case: { |
| 74 | + defaultRecordType: 'Svc_Technical_Support', |
| 75 | + }, |
| 76 | + }; |
| 77 | + |
| 78 | + await fs.promises.writeFile( |
| 79 | + path.join(session.project.dir, 'config', 'project-scratch-def-1.json'), |
| 80 | + JSON.stringify(scratchDefJson), |
| 81 | + 'utf-8' |
| 82 | + ); |
| 83 | + |
| 84 | + const username = execCmd<ScratchCreateResponse>( |
| 85 | + 'org create scratch -d -f config/project-scratch-def-1.json -a dreamhouse --duration-days 1', |
| 86 | + { |
| 87 | + ensureExitCode: 1, |
| 88 | + } |
| 89 | + ).jsonOutput?.result.username; |
| 90 | + |
| 91 | + const recordTypes = execCmd<{ recordTypeInfos: Array<{ name: string }> }>( |
| 92 | + `sobject describe --sobject Case --target-org ${username}`, |
| 93 | + { |
| 94 | + cli: 'sf', |
| 95 | + ensureExitCode: 0, |
| 96 | + } |
| 97 | + ).jsonOutput?.result.recordTypeInfos; |
| 98 | + |
| 99 | + expect(recordTypes?.find((rt) => rt.name === 'Svc_Technical_Support')); |
| 100 | + }); |
67 | 101 | it('creates an org from edition flag only and sets tracking to true by default', async () => { |
68 | 102 | const resp = execCmd<ScratchCreateResponse>('env:create:scratch --edition developer --json --wait 60', { |
69 | 103 | ensureExitCode: 0, |
|
0 commit comments