@@ -75,7 +75,7 @@ describe('Bootstrapping an app', () => {
7575 configHandlerTokens = { 'test-alias' : { token : aliasToken } } ,
7676 } = options ;
7777
78- // configHandler stub
78+ // configHandler stub (tokens only when hasAlias; do not stub get for auth - use configHandler.set('authorisationType', 'OAUTH') in tests instead)
7979 if ( hasAlias ) {
8080 sandbox . stub ( configHandler , 'get' ) . withArgs ( 'tokens' ) . returns ( configHandlerTokens ) ;
8181 }
@@ -371,9 +371,8 @@ describe('Bootstrapping an app', () => {
371371 } ,
372372 } ) ;
373373
374- // Mock region and cmaHost
375- command . region = mock . region ;
376- command . cmaHost = mock . region . cma ;
374+ // Mock region and cmaHost (base class getter uses _region, then cmaHost uses region)
375+ command . _region = mock . region ;
377376
378377 // Mock managementSDKClient
379378 const managementAPIClientStub = {
@@ -408,6 +407,7 @@ describe('Bootstrapping an app', () => {
408407 sandbox . restore ( ) ;
409408 sandbox = sinon . createSandbox ( ) ;
410409 setupStubs ( ) ;
410+ configHandler . set ( 'authorisationType' , 'OAUTH' ) ;
411411
412412 const BootstrapCommand = require ( '../lib/commands/cm/bootstrap' ) . default ;
413413 const command = new BootstrapCommand ( [ ] , { } ) ;
@@ -417,6 +417,8 @@ describe('Bootstrapping an app', () => {
417417 sandbox . stub ( interactive , 'inquireAppType' ) . resolves ( 'starterapp' ) ;
418418 sandbox . stub ( interactive , 'inquireApp' ) . resolves ( mock . appConfig ) ;
419419 sandbox . stub ( interactive , 'inquireCloneDirectory' ) . resolves ( '/test/path' ) ;
420+ sandbox . stub ( interactive , 'inquireLivePreviewSupport' ) ;
421+ sandbox . stub ( interactive , 'inquireRunDevServer' ) ;
420422
421423 // Mock config
422424 const config = require ( '../lib/config' ) ;
@@ -462,6 +464,7 @@ describe('Bootstrapping an app', () => {
462464 sandbox . restore ( ) ;
463465 sandbox = sinon . createSandbox ( ) ;
464466 setupStubs ( ) ;
467+ configHandler . set ( 'authorisationType' , 'OAUTH' ) ;
465468
466469 const BootstrapCommand = require ( '../lib/commands/cm/bootstrap' ) . default ;
467470 const command = new BootstrapCommand ( [ ] , { } ) ;
@@ -471,6 +474,8 @@ describe('Bootstrapping an app', () => {
471474 sandbox . stub ( interactive , 'inquireAppType' ) . resolves ( 'starterapp' ) ;
472475 sandbox . stub ( interactive , 'inquireApp' ) . resolves ( mock . appConfig ) ;
473476 sandbox . stub ( interactive , 'inquireCloneDirectory' ) . resolves ( '/test/path' ) ;
477+ sandbox . stub ( interactive , 'inquireLivePreviewSupport' ) ;
478+ sandbox . stub ( interactive , 'inquireRunDevServer' ) ;
474479
475480 // Mock config
476481 const config = require ( '../lib/config' ) ;
@@ -516,6 +521,7 @@ describe('Bootstrapping an app', () => {
516521 sandbox . restore ( ) ;
517522 sandbox = sinon . createSandbox ( ) ;
518523 setupStubs ( ) ;
524+ configHandler . set ( 'authorisationType' , 'OAUTH' ) ;
519525
520526 const BootstrapCommand = require ( '../lib/commands/cm/bootstrap' ) . default ;
521527 const command = new BootstrapCommand ( [ ] , { } ) ;
@@ -572,6 +578,7 @@ describe('Bootstrapping an app', () => {
572578 sandbox . restore ( ) ;
573579 sandbox = sinon . createSandbox ( ) ;
574580 setupStubs ( ) ;
581+ configHandler . set ( 'authorisationType' , 'OAUTH' ) ;
575582
576583 const BootstrapCommand = require ( '../lib/commands/cm/bootstrap' ) . default ;
577584 const command = new BootstrapCommand ( [ ] , { } ) ;
@@ -619,21 +626,23 @@ describe('Bootstrapping an app', () => {
619626 // Verify that appType is set correctly
620627 expect ( bootstrapOptions ) . to . not . be . null ;
621628 expect ( bootstrapOptions . appType ) . to . equal ( 'sampleapp' ) ;
622- // Verify that inquireApp was called with sampleApps
623- expect ( interactive . inquireApp . calledWith ( config . sampleApps ) ) . to . be . true ;
629+ // Verify that inquireApp was called with sampleApps (config.default in compiled CJS)
630+ expect ( interactive . inquireApp . calledWith ( config . default . sampleApps ) ) . to . be . true ;
624631 } ) ;
625632
626633 it ( 'should handle app-name flag correctly' , async ( ) => {
627634 sandbox . restore ( ) ;
628635 sandbox = sinon . createSandbox ( ) ;
629636 setupStubs ( ) ;
637+ configHandler . set ( 'authorisationType' , 'OAUTH' ) ;
630638
631639 const BootstrapCommand = require ( '../lib/commands/cm/bootstrap' ) . default ;
632640 const command = new BootstrapCommand ( [ ] , { } ) ;
633641
634- // Mock interactive functions
642+ // Mock interactive functions (stub inquireApp so .called exists for assertion)
635643 const interactive = require ( '../lib/bootstrap/interactive' ) ;
636644 sandbox . stub ( interactive , 'inquireAppType' ) . resolves ( 'starterapp' ) ;
645+ sandbox . stub ( interactive , 'inquireApp' ) . resolves ( mock . appConfig ) ;
637646 sandbox . stub ( interactive , 'inquireCloneDirectory' ) . resolves ( '/test/path' ) ;
638647 sandbox . stub ( interactive , 'inquireLivePreviewSupport' ) . resolves ( false ) ;
639648 sandbox . stub ( interactive , 'inquireRunDevServer' ) . resolves ( false ) ;
0 commit comments