44 * Licensed under the BSD 3-Clause license.
55 * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66 */
7- import { Org , Aliases , Config , ConfigAggregator , Lifecycle , SandboxEvents } from '@salesforce/core' ;
7+ import { Org , Lifecycle , GlobalInfo , SandboxEvents , SfdxConfigAggregator , SfdxPropertyKeys } from '@salesforce/core' ;
88import { fromStub , stubInterface , stubMethod } from '@salesforce/ts-sinon' ;
99import * as sinon from 'sinon' ;
10- import { expect , IConfig } from '@salesforce/command/lib/test' ;
10+ import { expect } from '@salesforce/command/lib/test' ;
11+ import { Config } from '@oclif/core' ;
1112import { UX } from '@salesforce/command' ;
1213import { OrgCloneCommand } from '../../../../src/commands/force/org/clone' ;
1314
@@ -54,14 +55,14 @@ describe('org:clone', () => {
5455 retries : 0 ,
5556 waitingOnAuth : false ,
5657 } ;
57- const oclifConfigStub = fromStub ( stubInterface < IConfig . IConfig > ( sandbox ) ) ;
58+ const oclifConfigStub = fromStub ( stubInterface < Config > ( sandbox ) ) ;
5859
5960 // stubs
6061 let uxTableStub : sinon . SinonStub ;
6162 let uxStyledHeaderStub : sinon . SinonStub ;
6263 let uxLogStub : sinon . SinonStub ;
6364 let cmd : TestOrgCloneCommand ;
64- let aliasSetStub : sinon . SinonStub ;
65+ let aliasSetStub : sinon . SinonSpy ;
6566 let configSetStub : sinon . SinonStub ;
6667 let configWriteStub : sinon . SinonStub ;
6768 let onStub : sinon . SinonStub ;
@@ -77,7 +78,7 @@ describe('org:clone', () => {
7778 public setOrg ( org : Org ) {
7879 this . org = org ;
7980 }
80- public setConfigAggregator ( configAggregator : ConfigAggregator ) {
81+ public setConfigAggregator ( configAggregator : SfdxConfigAggregator ) {
8182 this . configAggregator = configAggregator ;
8283 }
8384 }
@@ -104,7 +105,7 @@ describe('org:clone', () => {
104105 write : configWriteStub ,
105106 } ) ,
106107 } ;
107- configAggregatorStub = fromStub ( stubInterface < ConfigAggregator > ( sandbox , configAggregatorStubOptions ) ) ;
108+ configAggregatorStub = fromStub ( stubInterface < SfdxConfigAggregator > ( sandbox , configAggregatorStubOptions ) ) ;
108109 cmd . setConfigAggregator ( configAggregatorStub ) ;
109110 } ) ;
110111 if ( ! fails ) {
@@ -122,7 +123,15 @@ describe('org:clone', () => {
122123 stubMethod ( sandbox , Lifecycle , 'getInstance' ) . returns ( {
123124 on : onStub ,
124125 } ) ;
125- aliasSetStub = stubMethod ( sandbox , Aliases . prototype , 'set' ) . returns ( sandboxalias ) ;
126+ aliasSetStub = sinon . spy ( ) ;
127+ stubMethod ( sandbox , GlobalInfo , 'getInstance' ) . returns ( {
128+ aliases : {
129+ set : aliasSetStub ,
130+ getAll : ( ) => ( {
131+ sanboxname : sandboxalias ,
132+ } ) ,
133+ } ,
134+ } ) ;
126135 uxTableStub = stubMethod ( sandbox , UX . prototype , 'table' ) ;
127136 uxLogStub = stubMethod ( sandbox , UX . prototype , 'log' ) ;
128137 uxStyledHeaderStub = stubMethod ( sandbox , UX . prototype , 'styledHeader' ) ;
@@ -201,7 +210,7 @@ describe('org:clone', () => {
201210 expect ( aliasSetStub . callCount ) . to . be . equal ( 1 ) ;
202211 expect ( aliasSetStub . firstCall . args [ 0 ] ) . to . be . equal ( sandboxalias ) ;
203212 expect ( aliasSetStub . firstCall . args [ 1 ] ) . to . be . equal ( authUserName ) ;
204- expect ( configSetStub . firstCall . args [ 0 ] ) . to . be . equal ( Config . DEFAULT_USERNAME ) ;
213+ expect ( configSetStub . firstCall . args [ 0 ] ) . to . be . equal ( SfdxPropertyKeys . DEFAULT_USERNAME ) ;
205214 expect ( configSetStub . firstCall . args [ 1 ] ) . to . be . equal ( authUserName ) ;
206215 expect ( onStub . firstCall . firstArg ) . to . be . equal ( SandboxEvents . EVENT_ASYNC_RESULT ) ;
207216 expect ( onStub . secondCall . firstArg ) . to . be . equal ( SandboxEvents . EVENT_STATUS ) ;
0 commit comments