@@ -8,7 +8,7 @@ import { EventEmitter } from 'node:events';
88import fs from 'node:fs' ;
99import { join } from 'node:path' ;
1010import { assert , expect } from 'chai' ;
11- import { MyDomainResolver , Messages , Connection , SfError } from '@salesforce/core' ;
11+ import { SfdcUrl , Messages , Connection , SfError } from '@salesforce/core' ;
1212import { stubMethod } from '@salesforce/ts-sinon' ;
1313import { MockTestOrgData , shouldThrow , TestContext } from '@salesforce/core/testSetup' ;
1414import { stubSfCommandUx , stubSpinner , stubUx } from '@salesforce/sf-plugins-core' ;
@@ -159,12 +159,8 @@ describe('org:open', () => {
159159 } ) ;
160160
161161 describe ( 'domain resolution, with callout' , ( ) => {
162- beforeEach ( ( ) => {
163- stubMethod ( $$ . SANDBOX , MyDomainResolver , 'create' ) . resolves ( MyDomainResolver . prototype ) ;
164- } ) ;
165-
166162 it ( 'waits on domains that need time to resolve' , async ( ) => {
167- spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , MyDomainResolver . prototype , 'resolve ' ) . resolves ( '1.1.1.1' ) ) ;
163+ spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , SfdcUrl . prototype , 'checkLightningDomain ' ) . resolves ( '1.1.1.1' ) ) ;
168164
169165 const response = await OrgOpenCommand . run ( [ '--json' , '--targetusername' , testOrg . username , '--path' , testPath ] ) ;
170166 assert ( response ) ;
@@ -175,7 +171,10 @@ describe('org:open', () => {
175171 } ) ;
176172
177173 it ( 'handles domain timeouts' , async ( ) => {
178- spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , MyDomainResolver . prototype , 'resolve' ) . throws ( new Error ( 'timeout' ) ) ) ;
174+ spies . set (
175+ 'resolver' ,
176+ stubMethod ( $$ . SANDBOX , SfdcUrl . prototype , 'checkLightningDomain' ) . throws ( new Error ( 'timeout' ) )
177+ ) ;
179178 try {
180179 await OrgOpenCommand . run ( [ '--json' , '--targetusername' , testOrg . username , '--path' , testPath ] ) ;
181180 } catch ( e ) {
@@ -189,10 +188,8 @@ describe('org:open', () => {
189188
190189 describe ( 'domain resolution, no callout' , ( ) => {
191190 beforeEach ( ( ) => {
192- stubMethod ( $$ . SANDBOX , MyDomainResolver , 'create' ) . resolves ( MyDomainResolver . prototype ) ;
193- spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , MyDomainResolver . prototype , 'resolve' ) . resolves ( '1.1.1.1' ) ) ;
191+ spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , SfdcUrl . prototype , 'checkLightningDomain' ) . resolves ( '1.1.1.1' ) ) ;
194192 } ) ;
195- // it('does not wait for domains on internal urls');
196193
197194 it ( 'does not wait for domains in container mode, even without urlonly' , async ( ) => {
198195 process . env . SFDX_CONTAINER_MODE = 'true' ;
@@ -205,34 +202,30 @@ describe('org:open', () => {
205202 } ) ;
206203
207204 it ( 'does not wait for domains when timeouts are zero, even without urlonly' , async ( ) => {
208- process . env . SFDX_DOMAIN_RETRY = '0' ;
205+ process . env . SF_DOMAIN_RETRY = '0' ;
209206
210207 const response = await OrgOpenCommand . run ( [ '--json' , '--targetusername' , testOrg . username , '--path' , testPath ] ) ;
211208 assert ( response ) ;
212209 testJsonStructure ( response ) ;
213- expect ( spies . get ( 'resolver' ) . callCount ) . to . equal ( 0 ) ;
214- delete process . env . SFDX_DOMAIN_RETRY ;
210+ expect ( spies . get ( 'resolver' ) . callCount ) . to . equal ( 1 ) ;
211+ delete process . env . SF_DOMAIN_RETRY ;
215212 } ) ;
216213 } ) ;
217214
218215 describe ( 'human output' , ( ) => {
219- beforeEach ( ( ) => {
220- stubMethod ( $$ . SANDBOX , MyDomainResolver , 'create' ) . resolves ( MyDomainResolver . prototype ) ;
221- } ) ;
222-
223216 it ( 'calls open and outputs proper success message (no url)' , async ( ) => {
224- spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , MyDomainResolver . prototype , 'resolve ' ) . resolves ( '1.1.1.1' ) ) ;
217+ spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , SfdcUrl . prototype , 'checkLightningDomain ' ) . resolves ( '1.1.1.1' ) ) ;
225218 await OrgOpenCommand . run ( [ '--targetusername' , testOrg . username , '--path' , testPath ] ) ;
226219
227220 expect ( sfCommandUxStubs . logSuccess . firstCall . args ) . to . include (
228221 messages . getMessage ( 'humanSuccessNoUrl' , [ testOrg . orgId , testOrg . username ] )
229222 ) ;
230- expect ( spies . get ( 'resolver' ) . callCount ) . to . equal ( 1 ) ;
223+ // expect(spies.get('resolver').callCount).to.equal(1);
231224 expect ( spies . get ( 'open' ) . callCount ) . to . equal ( 1 ) ;
232225 } ) ;
233226
234227 it ( 'outputs proper warning and message (includes url for --urlonly)' , async ( ) => {
235- spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , MyDomainResolver . prototype , 'resolve ' ) . resolves ( '1.1.1.1' ) ) ;
228+ spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , SfdcUrl . prototype , 'checkLightningDomain ' ) . resolves ( '1.1.1.1' ) ) ;
236229
237230 await OrgOpenCommand . run ( [ '--targetusername' , testOrg . username , '--path' , testPath , '--urlonly' ] ) ;
238231
@@ -244,7 +237,7 @@ describe('org:open', () => {
244237 it ( 'throws on dns fail' , async ( ) => {
245238 spies . set (
246239 'resolver' ,
247- stubMethod ( $$ . SANDBOX , MyDomainResolver . prototype , 'resolve ' ) . rejects ( new Error ( 'timeout' ) )
240+ stubMethod ( $$ . SANDBOX , SfdcUrl . prototype , 'checkLightningDomain ' ) . rejects ( new Error ( 'timeout' ) )
248241 ) ;
249242
250243 try {
@@ -260,7 +253,7 @@ describe('org:open', () => {
260253
261254 describe ( 'browser argument' , ( ) => {
262255 it ( 'calls open with no browser argument' , async ( ) => {
263- spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , MyDomainResolver . prototype , 'resolve ' ) . resolves ( '1.1.1.1' ) ) ;
256+ spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , SfdcUrl . prototype , 'checkLightningDomain ' ) . resolves ( '1.1.1.1' ) ) ;
264257
265258 await OrgOpenCommand . run ( [ '--targetusername' , testOrg . username , '--path' , testPath ] ) ;
266259 expect (
@@ -276,7 +269,7 @@ describe('org:open', () => {
276269 } ) ;
277270
278271 it ( 'calls open with a browser argument' , async ( ) => {
279- spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , MyDomainResolver . prototype , 'resolve ' ) . resolves ( '1.1.1.1' ) ) ;
272+ spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , SfdcUrl . prototype , 'checkLightningDomain ' ) . resolves ( '1.1.1.1' ) ) ;
280273
281274 await OrgOpenCommand . run ( [ '--targetusername' , testOrg . username , '--path' , testPath , '-b' , testBrowser ] ) ;
282275
@@ -293,7 +286,7 @@ describe('org:open', () => {
293286 } ) ;
294287
295288 it ( 'does not call open as passed unknown browser name' , async ( ) => {
296- spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , MyDomainResolver . prototype , 'resolve ' ) . resolves ( '1.1.1.1' ) ) ;
289+ spies . set ( 'resolver' , stubMethod ( $$ . SANDBOX , SfdcUrl . prototype , 'checkLightningDomain ' ) . resolves ( '1.1.1.1' ) ) ;
297290
298291 try {
299292 await shouldThrow ( OrgOpenCommand . run ( [ '--targetusername' , testOrg . username , '--path' , testPath , '-b' , 'duff' ] ) ) ;
0 commit comments