55 * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66 */
77
8- import * as fs from 'fs' ;
98import * as path from 'path' ;
109import { TestSession , execCmd } from '@salesforce/cli-plugins-testkit' ;
1110import { expect } from 'chai' ;
@@ -100,11 +99,12 @@ describe('test sandbox status command', () => {
10099 }
101100 ) . jsonOutput . result ;
102101 expect ( orgStatusResult ) . to . be . ok ;
103-
104- const config = JSON . parse (
105- fs . readFileSync ( path . join ( session . project . dir , '..' , '.sfdx' , 'sfdx-config.json' ) , 'utf8' )
106- ) as Record < string , string > ;
107- expect ( config . defaultusername ) . to . be . equal ( `${ username } .${ sandboxName } ` ) ;
102+ const execOptions : shell . ExecOptions = {
103+ silent : true ,
104+ } ;
105+ const result = shell . exec ( 'sfdx config:get defaultusername --json' , execOptions ) as shell . ShellString ;
106+ expect ( result . code ) . to . equal ( 0 ) ;
107+ expect ( result . stdout ) . to . contain ( `"${ username } .${ sandboxName } "` ) ;
108108 } ) ;
109109
110110 it ( 'sandbox status command set alias' , async ( ) => {
@@ -115,18 +115,12 @@ describe('test sandbox status command', () => {
115115 }
116116 ) . jsonOutput . result ;
117117 expect ( orgStatusResult ) . to . be . ok ;
118-
119- const aliases = JSON . parse (
120- fs . readFileSync ( path . join ( session . project . dir , '..' , '.sfdx' , 'alias.json' ) , 'utf8' )
121- ) as {
122- orgs : Record < string , string > ;
118+ const execOptions : shell . ExecOptions = {
119+ silent : true ,
123120 } ;
124-
125- expect ( aliases ) . to . deep . equal ( {
126- orgs : {
127- [ `${ sandboxName } ` ] : `${ username } .${ sandboxName } ` ,
128- } ,
129- } ) ;
121+ const result = shell . exec ( 'sfdx alias:list --json' , execOptions ) as shell . ShellString ;
122+ expect ( result . code ) . to . equal ( 0 ) ;
123+ expect ( result . stdout ) . to . contain ( `"${ sandboxName } "` ) ;
130124 } ) ;
131125
132126 after ( async ( ) => {
0 commit comments