@@ -9,7 +9,6 @@ import fs from 'node:fs';
99import { join } from 'node:path' ;
1010import { assert , expect } from 'chai' ;
1111import { MyDomainResolver , Messages , Connection , SfError } from '@salesforce/core' ;
12- import { Config } from '@oclif/core' ;
1312import { stubMethod } from '@salesforce/ts-sinon' ;
1413import { MockTestOrgData , shouldThrow , TestContext } from '@salesforce/core/lib/testSetup.js' ;
1514import { stubSfCommandUx , stubSpinner , stubUx } from '@salesforce/sf-plugins-core' ;
@@ -98,44 +97,52 @@ describe('org:open', () => {
9897 } ) ;
9998
10099 it ( '--source-file to flexipage' , async ( ) => {
101- const cmd = new OrgOpenCommand (
102- [ '--json' , '--targetusername' , testOrg . username , '--urlonly' , '--source-file' , flexipagePath ] ,
103- { } as Config
104- ) ;
105-
106100 $$ . SANDBOX . stub ( Connection . prototype , 'singleRecordQuery' ) . resolves ( { Id : '123' } ) ;
107101
108- const response = await cmd . run ( ) ;
102+ const response = await OrgOpenCommand . run ( [
103+ '--json' ,
104+ '--targetusername' ,
105+ testOrg . username ,
106+ '--urlonly' ,
107+ '--source-file' ,
108+ flexipagePath ,
109+ ] ) ;
109110 expect ( response . url ) . to . include ( 'visualEditor/appBuilder.app?pageId=123' ) ;
110111 } ) ;
111112
112113 it ( '--source-file to an ApexPage' , async ( ) => {
113- const cmd = new OrgOpenCommand (
114- [ '--json' , '--targetusername' , testOrg . username , '--urlonly' , '--source-file' , apexPath ] ,
115- { } as Config
116- ) ;
117-
118- const response = await cmd . run ( ) ;
114+ const response = await OrgOpenCommand . run ( [
115+ '--json' ,
116+ '--targetusername' ,
117+ testOrg . username ,
118+ '--urlonly' ,
119+ '--source-file' ,
120+ apexPath ,
121+ ] ) ;
119122 expect ( response . url ) . to . include ( '&retURL=/apex/test' ) ;
120123 } ) ;
121124
122125 it ( '--source-file when flexipage query errors' , async ( ) => {
123- const cmd = new OrgOpenCommand (
124- [ '--json' , '--targetusername' , testOrg . username , '--urlonly' , '--source-file' , flexipagesDir ] ,
125- { } as Config
126- ) ;
127-
128- const response = await cmd . run ( ) ;
126+ const response = await OrgOpenCommand . run ( [
127+ '--json' ,
128+ '--targetusername' ,
129+ testOrg . username ,
130+ '--urlonly' ,
131+ '--source-file' ,
132+ flexipagesDir ,
133+ ] ) ;
129134 expect ( response . url ) . to . include ( 'lightning/setup/FlexiPageList/home' ) ;
130135 } ) ;
131136
132137 it ( '--source-file to neither flexipage or apexpage' , async ( ) => {
133- const cmd = new OrgOpenCommand (
134- [ '--json' , '--targetusername' , testOrg . username , '--urlonly' , '--source-file' , apexDir ] ,
135- { } as Config
136- ) ;
137-
138- const response = await cmd . run ( ) ;
138+ const response = await OrgOpenCommand . run ( [
139+ '--json' ,
140+ '--targetusername' ,
141+ testOrg . username ,
142+ '--urlonly' ,
143+ '--source-file' ,
144+ apexDir ,
145+ ] ) ;
139146 expect ( response . url ) . to . include ( 'lightning/setup/FlexiPageList/home' ) ;
140147 } ) ;
141148 } ) ;
0 commit comments