@@ -400,4 +400,100 @@ describe("update_pr_description_helpers.cjs", () => {
400400 expect ( mockCore . info ) . toHaveBeenCalledWith ( expect . stringContaining ( "append" ) ) ;
401401 } ) ;
402402 } ) ;
403+
404+ describe ( "Footer parameter" , ( ) => {
405+ it ( "should omit footer when includeFooter is false" , ( ) => {
406+ const result = updateBody ( {
407+ currentBody : "Original" ,
408+ newContent : "New content" ,
409+ operation : "append" ,
410+ workflowName : "Test" ,
411+ runUrl : "https://github.com/test/actions/runs/123" ,
412+ runId : 123 ,
413+ includeFooter : false ,
414+ } ) ;
415+ expect ( result ) . toContain ( "Original" ) ;
416+ expect ( result ) . toContain ( "New content" ) ;
417+ expect ( result ) . not . toContain ( "Generated by" ) ;
418+ expect ( result ) . not . toContain ( "AI generated" ) ;
419+ } ) ;
420+
421+ it ( "should include footer by default when includeFooter is not specified" , ( ) => {
422+ const result = updateBody ( {
423+ currentBody : "Original" ,
424+ newContent : "New content" ,
425+ operation : "append" ,
426+ workflowName : "Test" ,
427+ runUrl : "https://github.com/test/actions/runs/123" ,
428+ runId : 123 ,
429+ // includeFooter not specified, should default to true
430+ } ) ;
431+ expect ( result ) . toContain ( "Original" ) ;
432+ expect ( result ) . toContain ( "New content" ) ;
433+ expect ( result ) . toContain ( "Generated by" ) ;
434+ } ) ;
435+
436+ it ( "should include footer when includeFooter is explicitly true" , ( ) => {
437+ const result = updateBody ( {
438+ currentBody : "Original" ,
439+ newContent : "New content" ,
440+ operation : "append" ,
441+ workflowName : "Test" ,
442+ runUrl : "https://github.com/test/actions/runs/123" ,
443+ runId : 123 ,
444+ includeFooter : true ,
445+ } ) ;
446+ expect ( result ) . toContain ( "Original" ) ;
447+ expect ( result ) . toContain ( "New content" ) ;
448+ expect ( result ) . toContain ( "Generated by" ) ;
449+ } ) ;
450+
451+ it ( "should omit footer in replace operation when includeFooter is false" , ( ) => {
452+ const result = updateBody ( {
453+ currentBody : "Original" ,
454+ newContent : "Replacement" ,
455+ operation : "replace" ,
456+ workflowName : "Test" ,
457+ runUrl : "https://github.com/test/actions/runs/123" ,
458+ runId : 123 ,
459+ includeFooter : false ,
460+ } ) ;
461+ expect ( result ) . toBe ( "Replacement" ) ;
462+ expect ( result ) . not . toContain ( "Generated by" ) ;
463+ } ) ;
464+
465+ it ( "should omit footer in prepend operation when includeFooter is false" , ( ) => {
466+ const result = updateBody ( {
467+ currentBody : "Original" ,
468+ newContent : "Prepended" ,
469+ operation : "prepend" ,
470+ workflowName : "Test" ,
471+ runUrl : "https://github.com/test/actions/runs/123" ,
472+ runId : 123 ,
473+ includeFooter : false ,
474+ } ) ;
475+ expect ( result ) . toContain ( "Prepended" ) ;
476+ expect ( result ) . toContain ( "Original" ) ;
477+ expect ( result ) . not . toContain ( "Generated by" ) ;
478+ } ) ;
479+
480+ it ( "should omit footer in replace-island operation when includeFooter is false" , ( ) => {
481+ const currentBody = "Before\n<!-- gh-aw-island-start:123 -->\nOld island\n<!-- gh-aw-island-end:123 -->\nAfter" ;
482+ const result = updateBody ( {
483+ currentBody,
484+ newContent : "New island" ,
485+ operation : "replace-island" ,
486+ workflowName : "Test" ,
487+ runUrl : "https://github.com/test/actions/runs/123" ,
488+ runId : 123 ,
489+ includeFooter : false ,
490+ } ) ;
491+ expect ( result ) . toContain ( "Before" ) ;
492+ expect ( result ) . toContain ( "New island" ) ;
493+ expect ( result ) . toContain ( "After" ) ;
494+ expect ( result ) . not . toContain ( "Generated by" ) ;
495+ expect ( result ) . toContain ( "<!-- gh-aw-island-start:123 -->" ) ;
496+ expect ( result ) . toContain ( "<!-- gh-aw-island-end:123 -->" ) ;
497+ } ) ;
498+ } ) ;
403499} ) ;
0 commit comments