File tree Expand file tree Collapse file tree
contentstack-bootstrap/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ export interface SeedParams {
2828 stackAPIKey ?: string ;
2929 org ?: string ;
3030 stackName ?: string ;
31- yes ?: string ;
31+ yes ?: boolean ;
3232 managementTokenAlias ?: string | undefined ;
3333 managementToken ?: string | undefined ;
3434}
@@ -95,7 +95,7 @@ export default class Bootstrap {
9595 cmd . push ( '-n' , this . options . seedParams . stackName ) ;
9696 }
9797 if ( this . options . seedParams . yes ) {
98- cmd . push ( '-y' , this . options . seedParams . yes ) ;
98+ cmd . push ( '-y' ) ;
9999 }
100100 if ( this . options . seedParams . managementTokenAlias ) {
101101 cmd . push ( '--alias' , this . options . seedParams . managementTokenAlias ) ;
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ export default class BootstrapCommand extends Command {
7373 required : false ,
7474 exclusive : [ 'stack-api-key' ] ,
7575 } ) ,
76- yes : flags . string ( {
76+ yes : flags . boolean ( {
7777 description : '[Optional] Skip stack confirmation' ,
7878 char : 'y' ,
7979 required : false ,
@@ -157,7 +157,7 @@ export default class BootstrapCommand extends Command {
157157 } ) ;
158158 }
159159
160- const yes = bootstrapCommandFlags . yes as string ;
160+ const yes = bootstrapCommandFlags . yes as boolean ;
161161
162162 const appConfig : AppConfig = getAppLevelConfigByName ( selectedAppName || selectedApp . configKey ) ;
163163 const master_locale = appConfig . master_locale || DEFAULT_MASTER_LOCALE ;
@@ -181,7 +181,7 @@ export default class BootstrapCommand extends Command {
181181 if ( stackAPIKey ) seedParams . stackAPIKey = stackAPIKey ;
182182 if ( org ) seedParams . org = org ;
183183 if ( stackName ) seedParams . stackName = stackName ;
184- if ( yes ) seedParams . yes = yes ;
184+ if ( yes ) seedParams . yes = true ;
185185 if ( managementTokenAlias ) {
186186 seedParams . managementTokenAlias = managementTokenAlias ;
187187 const listOfTokens = configHandler . get ( 'tokens' ) ;
Original file line number Diff line number Diff line change @@ -99,6 +99,17 @@ describe('ContentModelSeeder', () => {
9999 expect ( proceed ) . toBe ( true ) ;
100100 } ) ;
101101
102+ test ( 'should skip confirmation when skipStackConfirmation is true' , async ( ) => {
103+ ContentstackClient . prototype . getContentTypeCount = jest . fn ( ) . mockResolvedValue ( 1 ) ;
104+
105+ const optionsWithSkip = { ...options , skipStackConfirmation : true } ;
106+ const seeder = new ContentModelSeeder ( optionsWithSkip ) ;
107+ const proceed = await seeder . shouldProceed ( api_key ) ;
108+
109+ expect ( proceed ) . toBe ( true ) ;
110+ expect ( inquireProceed ) . not . toHaveBeenCalled ( ) ;
111+ } ) ;
112+
102113 test ( 'should create stack' , async ( ) => {
103114 ContentstackClient . prototype . createStack = jest . fn ( ) . mockResolvedValue ( {
104115 api_key : api_key ,
You can’t perform that action at this time.
0 commit comments