@@ -65,7 +65,7 @@ describe('env create scratch NUTs', () => {
6565 describe ( 'successes' , ( ) => {
6666 const keys = [ 'username' , 'orgId' , 'scratchOrgInfo' , 'authFields' , 'warnings' ] ;
6767
68- it ( 'creates an org with capitalized record types' , async ( ) => {
68+ it ( 'creates an org with capitalized record types if no config var is set ' , async ( ) => {
6969 const scratchDefJson = parseJsonMap (
7070 await fs . promises . readFile ( path . join ( session . project . dir , 'config' , 'project-scratch-def.json' ) , 'utf8' )
7171 ) ;
@@ -75,18 +75,33 @@ describe('env create scratch NUTs', () => {
7575 } ,
7676 } ;
7777
78+ // NOTE: remove this once it starts capitalizing record types by default.
79+ // we are unsetting it here to ensure the warning from sfdx-core is emitted.
80+ await execCmd ( 'config unset org-capitalize-record-types' , {
81+ async : true ,
82+ cli : 'sf' ,
83+ ensureExitCode : 0 ,
84+ } ) ;
85+
7886 await fs . promises . writeFile (
7987 path . join ( session . project . dir , 'config' , 'project-scratch-def-1.json' ) ,
8088 JSON . stringify ( scratchDefJson ) ,
8189 'utf-8'
8290 ) ;
8391
84- const username = execCmd < ScratchCreateResponse > (
92+ const jsonOutput = execCmd < ScratchCreateResponse > (
8593 'org create scratch -d -f config/project-scratch-def-1.json -a dreamhouse --duration-days 1' ,
8694 {
8795 ensureExitCode : 0 ,
8896 }
89- ) . jsonOutput ?. result . username ;
97+ ) . jsonOutput ;
98+
99+ const noConfigVarWarning =
100+ 'Record types defined in the scratch org definition file will stop being capitalized by default in a future release.\nSet the `org-capitalize-record-types` config var to `true` to enforce capitalization.' ;
101+
102+ expect ( jsonOutput ?. warnings [ 0 ] === noConfigVarWarning ) ;
103+
104+ const username = jsonOutput ?. result . username ;
90105
91106 const recordTypes = execCmd < { recordTypeInfos : Array < { name : string } > } > (
92107 `sobject describe --sobject Case --target-org ${ username } ` ,
@@ -98,6 +113,48 @@ describe('env create scratch NUTs', () => {
98113
99114 expect ( recordTypes ?. find ( ( rt ) => rt . name === 'Svc_Technical_Support' ) ) ;
100115 } ) ;
116+ it ( 'creates an org without capitalized record types' , async ( ) => {
117+ const scratchDefJson = parseJsonMap (
118+ await fs . promises . readFile ( path . join ( session . project . dir , 'config' , 'project-scratch-def.json' ) , 'utf8' )
119+ ) ;
120+ scratchDefJson . objectSettings = {
121+ case : {
122+ defaultRecordType : 'Svc_Technical_Support' ,
123+ } ,
124+ } ;
125+
126+ // NOTE: remove this once it starts capitalizing record types by default.
127+ await execCmd ( 'config set org-capitalize-record-types=false' , {
128+ async : true ,
129+ cli : 'sf' ,
130+ ensureExitCode : 0 ,
131+ } ) ;
132+
133+ await fs . promises . writeFile (
134+ path . join ( session . project . dir , 'config' , 'project-scratch-def-1.json' ) ,
135+ JSON . stringify ( scratchDefJson ) ,
136+ 'utf-8'
137+ ) ;
138+
139+ const jsonOutput = execCmd < ScratchCreateResponse > (
140+ 'org create scratch -d -f config/project-scratch-def-1.json -a dreamhouse --duration-days 1' ,
141+ {
142+ ensureExitCode : 0 ,
143+ }
144+ ) . jsonOutput ;
145+
146+ const username = jsonOutput ?. result . username ;
147+
148+ const recordTypes = execCmd < { recordTypeInfos : Array < { name : string } > } > (
149+ `sobject describe --sobject Case --target-org ${ username } ` ,
150+ {
151+ cli : 'sf' ,
152+ ensureExitCode : 0 ,
153+ }
154+ ) . jsonOutput ?. result . recordTypeInfos ;
155+
156+ expect ( recordTypes ?. find ( ( rt ) => rt . name === 'svc_Technical_Support' ) ) ;
157+ } ) ;
101158 it ( 'creates an org from edition flag only and sets tracking to true by default' , async ( ) => {
102159 const resp = execCmd < ScratchCreateResponse > ( 'env:create:scratch --edition developer --json --wait 60' , {
103160 ensureExitCode : 0 ,
0 commit comments