@@ -74,6 +74,13 @@ const agentComponents: SourceComponent[] = [
7474 } ) ,
7575] ;
7676
77+ // Component with type that triggers cascade delete warning (AiAuthoringBundle)
78+ const aiAuthoringBundleComponent = new SourceComponent ( {
79+ name : 'MyAiBundle' ,
80+ type : registry . getTypeByName ( 'AiAuthoringBundle' ) ,
81+ xml : '/dreamhouse-lwc/force-app/main/default/aiAuthoringBundles/MyAiBundle.agent-meta.xml' ,
82+ } ) ;
83+
7784export const exampleDeleteResponse = {
7885 // required but ignored by the delete UT
7986 getFileResponses : ( ) : void => { } ,
@@ -168,6 +175,7 @@ describe('project delete source', () => {
168175 options ?: {
169176 sourceApiVersion ?: string ;
170177 inquirerMock ?: { checkbox : sinon . SinonStub } ;
178+ captureConfirmMessage ?: { ref : { message : string } } ;
171179 }
172180 ) => {
173181 const cmd = new TestDelete ( params , oclifConfigStub ) ;
@@ -192,7 +200,15 @@ describe('project delete source', () => {
192200 onCancel : ( ) => { } ,
193201 onError : ( ) => { } ,
194202 } ) ;
195- handlePromptStub = stubMethod ( $$ . SANDBOX , cmd , 'handlePrompt' ) . returns ( confirm ) ;
203+ if ( options ?. captureConfirmMessage ) {
204+ const messageRef = options . captureConfirmMessage . ref ;
205+ stubMethod ( $$ . SANDBOX , SfCommand . prototype , 'confirm' ) . callsFake ( async ( opts : { message : string } ) => {
206+ messageRef . message = opts . message ;
207+ return true ;
208+ } ) ;
209+ } else {
210+ handlePromptStub = stubMethod ( $$ . SANDBOX , cmd , 'handlePrompt' ) . returns ( confirm ) ;
211+ }
196212 if ( options ?. inquirerMock ) {
197213 // @ts -expect-error stubbing private member of the command
198214 cmd . inquirer = options . inquirerMock ;
@@ -371,4 +387,24 @@ describe('project delete source', () => {
371387 } ) ;
372388 ensureHookArgs ( ) ;
373389 } ) ;
390+
391+ it ( 'should include cascade delete warning in prompt when deleting AiAuthoringBundle' , async ( ) => {
392+ buildComponentSetStub . restore ( ) ;
393+ buildComponentSetStub = stubMethod ( $$ . SANDBOX , ComponentSetBuilder , 'build' ) . resolves ( {
394+ toArray : ( ) => [ aiAuthoringBundleComponent ] ,
395+ forceIgnoredPaths : undefined ,
396+ apiVersion : '65.0' ,
397+ sourceApiVersion : '65.0' ,
398+ } ) ;
399+
400+ const captured = { message : '' } ;
401+ await runDeleteCmd ( [ '--metadata' , 'AiAuthoringBundle:MyAiBundle' , '--json' ] , {
402+ captureConfirmMessage : { ref : captured } ,
403+ } ) ;
404+
405+ expect ( captured . message ) . to . include ( 'AiAuthoringBundle' ) ;
406+ expect ( captured . message ) . to . include ( 'cascade' ) ;
407+ expect ( captured . message ) . to . include ( 'Bot, BotVersion, GenAiPlannerBundle' ) ;
408+ ensureHookArgs ( ) ;
409+ } ) ;
374410} ) ;
0 commit comments