@@ -37,8 +37,6 @@ const fakeOrg: AuthFields = {
3737
3838describe ( 'org:create:sandbox' , ( ) => {
3939 beforeEach ( ( ) => {
40- // stubMethod(sandbox, OrgAccessor.prototype, 'read').callsFake(async (): Promise<AuthFields> => fakeOrg);
41- // stubMethod(sandbox, OrgAccessor.prototype, 'write').callsFake(async (): Promise<AuthFields> => fakeOrg);
4240 stubMethod ( sandbox , OrgAccessor . prototype , 'read' ) . resolves ( fakeOrg ) ;
4341 stubMethod ( sandbox , OrgAccessor . prototype , 'write' ) . resolves ( fakeOrg ) ;
4442 sfCommandUxStubs = stubSfCommandUx ( sandbox ) ;
@@ -53,23 +51,18 @@ describe('org:create:sandbox', () => {
5351 it ( 'will print the correct message for asyncResult lifecycle event' , async ( ) => {
5452 stubMethod ( sandbox , Org , 'create' ) . resolves ( Org . prototype ) ;
5553 stubMethod ( sandbox , Org . prototype , 'getUsername' ) . returns ( 'testProdOrg' ) ;
56- const createStub = stubMethod ( sandbox , Org . prototype , 'createSandbox' ) . callsFake ( async ( ) =>
57- ( async ( ) => { } ) ( ) . catch ( )
58- ) ;
54+ const createStub = stubMethod ( sandbox , Org . prototype , 'createSandbox' ) . callsFake ( async ( ) => {
55+ await Lifecycle . getInstance ( ) . emit ( SandboxEvents . EVENT_ASYNC_RESULT , sandboxProcessObj ) ;
56+ } ) ;
5957
6058 await CreateSandbox . run ( [ '-o' , 'testProdOrg' , '--name' , 'mysandboxx' , '--no-prompt' ] ) ;
6159
62- expect ( createStub . firstCall . args [ 0 ] . SandboxName ) . includes ( 'mysandboxx' ) ;
63- expect ( createStub . firstCall . args [ 0 ] . SandboxName . length ) . equals ( 10 ) ;
64-
65- Lifecycle . getInstance ( ) . on ( SandboxEvents . EVENT_ASYNC_RESULT , async ( result ) => {
66- expect ( result ) . to . deep . equal ( sandboxProcessObj ) ;
67- expect ( sfCommandUxStubs . info . firstCall . firstArg ) . to . include ( sandboxProcessObj . Id ) ;
68- return Promise . resolve ( ) ;
60+ expect ( createStub . firstCall . firstArg ) . to . deep . equal ( {
61+ SandboxName : 'mysandboxx' ,
62+ LicenseType : 'Developer' ,
6963 } ) ;
70-
71- await Lifecycle . getInstance ( ) . emit ( SandboxEvents . EVENT_ASYNC_RESULT , sandboxProcessObj ) ;
72- Lifecycle . getInstance ( ) . removeAllListeners ( SandboxEvents . EVENT_ASYNC_RESULT ) ;
64+ const expectedInfoMsg = `org resume sandbox --job-id ${ sandboxProcessObj . Id } -o testProdOrg` ;
65+ expect ( sfCommandUxStubs . info . firstCall . firstArg ) . to . include ( expectedInfoMsg ) ;
7366 } ) ;
7467 } ) ;
7568
0 commit comments