@@ -67,6 +67,7 @@ describe('org:clone', () => {
6767 let configWriteStub : sinon . SinonStub ;
6868 let onStub : sinon . SinonStub ;
6969 let readFileSyncStub : sinon . SinonStub ;
70+ let cloneSandboxStub : sinon . SinonStub ;
7071 let configAggregatorStub ;
7172
7273 class TestOrgCloneCommand extends OrgCloneCommand {
@@ -85,10 +86,11 @@ describe('org:clone', () => {
8586 const runCloneCommand = async ( params : string [ ] ) => {
8687 cmd = new TestOrgCloneCommand ( params , oclifConfigStub ) ;
8788 stubMethod ( sandbox , cmd , 'assignOrg' ) . callsFake ( ( ) => {
89+ cloneSandboxStub = sandbox . stub ( ) . callsFake ( async ( ) => {
90+ return sandboxProcessObj ;
91+ } ) ;
8892 const orgStubOptions = {
89- cloneSandbox : sandbox . stub ( ) . callsFake ( async ( ) => {
90- return sandboxProcessObj ;
91- } ) ,
93+ cloneSandbox : cloneSandboxStub ,
9294 } ;
9395 const orgStub = fromStub ( stubInterface < Org > ( sandbox , orgStubOptions ) ) ;
9496 cmd . setOrg ( orgStub ) ;
@@ -132,6 +134,39 @@ describe('org:clone', () => {
132134 expect ( onStub . secondCall . firstArg ) . to . be . equal ( SandboxEvents . EVENT_STATUS ) ;
133135 expect ( onStub . thirdCall . firstArg ) . to . be . equal ( SandboxEvents . EVENT_RESULT ) ;
134136 expect ( onStub . callCount ) . to . be . equal ( 3 ) ;
137+ expect ( cloneSandboxStub . firstCall . firstArg ) . to . deep . equal ( {
138+ LicenseType : 'Developer' ,
139+ SandboxName : 'newSandbox' ,
140+ } ) ;
141+ expect ( res ) . to . deep . equal ( sandboxProcessObj ) ;
142+ } ) ;
143+
144+ it ( 'will return sandbox process object varargs override defFile' , async ( ) => {
145+ const licenseType = 'Enterprise' ;
146+ const res = await runCloneCommand ( [
147+ '-t' ,
148+ 'sandbox' ,
149+ '-u' ,
150+ 'DevHub' ,
151+ '-f' ,
152+ 'sandbox-def.json' ,
153+ `licenseType=${ licenseType } ` ,
154+ ] ) ;
155+ expect ( uxStyledHeaderStub . calledOnce ) . to . be . true ;
156+ expect ( uxTableStub . firstCall . args [ 0 ] . length ) . to . be . equal ( 12 ) ;
157+ expect ( readFileSyncStub . calledOnce ) . to . be . true ;
158+ expect ( uxLogStub . callCount ) . to . be . equal ( 3 ) ;
159+ expect ( aliasSetStub . callCount ) . to . be . equal ( 0 ) ;
160+ expect ( configSetStub . callCount ) . to . be . equal ( 0 ) ;
161+ expect ( configWriteStub . callCount ) . to . be . equal ( 0 ) ;
162+ expect ( onStub . firstCall . firstArg ) . to . be . equal ( SandboxEvents . EVENT_ASYNC_RESULT ) ;
163+ expect ( onStub . secondCall . firstArg ) . to . be . equal ( SandboxEvents . EVENT_STATUS ) ;
164+ expect ( onStub . thirdCall . firstArg ) . to . be . equal ( SandboxEvents . EVENT_RESULT ) ;
165+ expect ( onStub . callCount ) . to . be . equal ( 3 ) ;
166+ expect ( cloneSandboxStub . firstCall . firstArg ) . to . deep . equal ( {
167+ LicenseType : licenseType ,
168+ SandboxName : 'newSandbox' ,
169+ } ) ;
135170 expect ( res ) . to . deep . equal ( sandboxProcessObj ) ;
136171 } ) ;
137172
@@ -160,6 +195,10 @@ describe('org:clone', () => {
160195 expect ( onStub . secondCall . firstArg ) . to . be . equal ( SandboxEvents . EVENT_STATUS ) ;
161196 expect ( onStub . thirdCall . firstArg ) . to . be . equal ( SandboxEvents . EVENT_RESULT ) ;
162197 expect ( onStub . callCount ) . to . be . equal ( 3 ) ;
198+ expect ( cloneSandboxStub . firstCall . firstArg ) . to . deep . equal ( {
199+ LicenseType : 'Developer' ,
200+ SandboxName : 'newSandbox' ,
201+ } ) ;
163202 expect ( configWriteStub . calledOnce ) . to . be . true ;
164203 expect ( res ) . to . deep . equal ( sandboxProcessObj ) ;
165204 } ) ;
0 commit comments