66 */
77
88import { join } from 'path' ;
9+ import * as os from 'os' ;
910import { expect , config , assert } from 'chai' ;
1011import { TestSession } from '@salesforce/cli-plugins-testkit' ;
1112import { execCmd } from '@salesforce/cli-plugins-testkit' ;
@@ -91,7 +92,7 @@ describe('Org Command NUT', () => {
9192
9293 describe ( 'List Orgs' , ( ) => {
9394 it ( 'should list all orgs' , ( ) => {
94- const listResult = execCmd < OrgListResult > ( 'force: org:list --json' , { ensureExitCode : 0 } ) . jsonOutput ?. result ;
95+ const listResult = execCmd < OrgListResult > ( 'org:list --json' , { ensureExitCode : 0 } ) . jsonOutput ?. result ;
9596 assert ( listResult ) ;
9697 expect ( listResult ) . to . have . property ( 'nonScratchOrgs' ) ;
9798 expect ( listResult . nonScratchOrgs ) . to . have . length ( 1 ) ;
@@ -121,8 +122,8 @@ describe('Org Command NUT', () => {
121122 JSON . stringify ( listResult . nonScratchOrgs [ 0 ] )
122123 ) ;
123124 } ) ;
124- it ( 'should list orgs - skipconnectionstatus ' , ( ) => {
125- const listResult = execCmd < OrgListResult > ( 'force: org:list --skipconnectionstatus --json' , { ensureExitCode : 0 } )
125+ it ( 'should list orgs - skip-connection-status ' , ( ) => {
126+ const listResult = execCmd < OrgListResult > ( 'org:list --skip-connection-status --json' , { ensureExitCode : 0 } )
126127 . jsonOutput ?. result ;
127128 assert ( listResult ) ;
128129 const nonScratchOrgs = listResult . nonScratchOrgs [ 0 ] ;
@@ -136,25 +137,25 @@ describe('Org Command NUT', () => {
136137 ) ;
137138 } ) ;
138139 it ( 'should list orgs in a human readable form' , ( ) => {
139- const lines = execCmd ( 'force: org:list' , { ensureExitCode : 0 } ) . shellOutput . stdout . split ( '\n' ) ;
140+ const lines = execCmd ( 'org:list' , { ensureExitCode : 0 } ) . shellOutput . stdout . split ( os . EOL ) ;
140141 verifyHumanResults ( lines , defaultUsername , aliasedUsername ) ;
141142 } ) ;
142143 it ( 'should list additional information with --verbose' , ( ) => {
143- const lines = execCmd ( 'force: org:list --verbose' , { ensureExitCode : 0 } ) . shellOutput . stdout . split ( '\n' ) ;
144+ const lines = execCmd ( 'org:list --verbose' , { ensureExitCode : 0 } ) . shellOutput . stdout . split ( os . EOL ) ;
144145 verifyHumanResults ( lines , defaultUsername , aliasedUsername , true ) ;
145146 } ) ;
146147 } ) ;
147148 describe ( 'Org Display' , ( ) => {
148149 it ( 'should display org information for default username' , ( ) => {
149- const result = execCmd < OrgListResult > ( 'force: org:display --json' , { ensureExitCode : 0 } ) . jsonOutput ?. result ;
150+ const result = execCmd < OrgListResult > ( 'org:display --json' , { ensureExitCode : 0 } ) . jsonOutput ?. result ;
150151 expect ( result ) . to . be . ok ;
151152 expect ( result ) . to . include ( {
152153 devHubId : hubOrgUsername ,
153154 username : defaultUsername ,
154155 } ) ;
155156 } ) ;
156157 it ( 'should display scratch org information for alias' , ( ) => {
157- const result = execCmd < OrgListResult > ( `force: org:display -u ${ aliasedUsername } --json` , { ensureExitCode : 0 } )
158+ const result = execCmd < OrgListResult > ( `org:display -u ${ aliasedUsername } --json` , { ensureExitCode : 0 } )
158159 . jsonOutput ?. result ;
159160 expect ( result ) . to . be . ok ;
160161 expect ( result ) . to . include ( {
@@ -163,16 +164,16 @@ describe('Org Command NUT', () => {
163164 } ) ;
164165 } ) ;
165166 it ( 'should display human readable org information for default username' , ( ) => {
166- const lines = execCmd < OrgDisplayReturn > ( 'force: org:display' , { ensureExitCode : 0 } ) . shellOutput . stdout . split (
167- '\n'
168- ) ;
167+ const result = execCmd < OrgDisplayReturn > ( 'org:display' , { ensureExitCode : 0 } ) . shellOutput ;
168+ const stdout = result . stdout ;
169+ const lines = stdout . split ( os . EOL ) ;
169170 expect ( lines . length ) . to . have . greaterThan ( 0 ) ;
170171 const usernameLine = lines . find ( ( line ) => line . includes ( 'Username' ) ) ;
171172 expect ( usernameLine ) . to . include ( defaultUsername ) ;
172173 } ) ;
173174 it ( 'should display human readable scratch org information for alias' , ( ) => {
174- const lines = execCmd ( `force:org:display -u ${ aliasedUsername } ` , { ensureExitCode : 0 } ) . shellOutput . stdout . split (
175- '\n'
175+ const lines = execCmd ( `force:org:display -o ${ aliasedUsername } ` , { ensureExitCode : 0 } ) . shellOutput . stdout . split (
176+ os . EOL
176177 ) ;
177178 expect ( lines . length ) . to . have . greaterThan ( 0 ) ;
178179 const usernameLine = lines . find ( ( line ) => line . includes ( 'Username' ) ) ;
@@ -181,15 +182,15 @@ describe('Org Command NUT', () => {
181182 } ) ;
182183 describe ( 'Org Open' , ( ) => {
183184 it ( 'should produce the URL for an org in json' , ( ) => {
184- const result = execCmd < OrgOpenOutput > ( `force: org:open -u ${ defaultUsername } --urlonly --json` , {
185+ const result = execCmd < OrgOpenOutput > ( `org:open -o ${ defaultUsername } --url-only --json` , {
185186 ensureExitCode : 0 ,
186187 } ) . jsonOutput ?. result ;
187188 expect ( result ) . to . be . ok ;
188189 expect ( result ) . to . include ( { orgId : defaultUserOrgId , username : defaultUsername } ) ;
189190 } ) ;
190191 it ( 'should produce the URL with given path for an org in json' , ( ) => {
191192 const result = execCmd < OrgOpenOutput > (
192- `force:org:open -u ${ aliasedUsername } --urlonly --path "foo/bar/baz" --json` ,
193+ `force:org:open -o ${ aliasedUsername } --urlonly --path "foo/bar/baz" --json` ,
193194 {
194195 ensureExitCode : 0 ,
195196 }
0 commit comments