@@ -654,213 +654,6 @@ describe('Change Set Formatter', () => {
654654 expect ( markdown ) . toContain ( '⚠️ Requires recreation: Always' )
655655 } )
656656
657- test ( 'diffs Tags arrays correctly' , ( ) => {
658- const changesSummary = JSON . stringify ( {
659- changes : [
660- {
661- Type : 'Resource' ,
662- ResourceChange : {
663- Action : 'Modify' ,
664- LogicalResourceId : 'MyParameter' ,
665- ResourceType : 'AWS::SSM::Parameter' ,
666- Replacement : 'False' ,
667- Scope : [ 'Properties' ] ,
668- Details : [
669- {
670- Target : {
671- Attribute : 'Properties' ,
672- Name : 'Tags' ,
673- RequiresRecreation : 'Never' ,
674- BeforeValue : JSON . stringify ( [
675- { Key : 'Version' , Value : 'v1' } ,
676- { Key : 'Team' , Value : 'DevOps' } ,
677- { Key : 'Environment' , Value : 'test' }
678- ] ) ,
679- AfterValue : JSON . stringify ( [
680- { Key : 'Version' , Value : 'v2' } ,
681- { Key : 'UpdateType' , Value : 'InPlace' } ,
682- { Key : 'Environment' , Value : 'production' }
683- ] )
684- }
685- }
686- ]
687- }
688- }
689- ] ,
690- totalChanges : 1 ,
691- truncated : false
692- } )
693-
694- const markdown = generateChangeSetMarkdown ( changesSummary )
695-
696- expect ( markdown ) . toContain ( '**Tags:**' )
697- expect ( markdown ) . toContain ( '**Tags.Environment:** `test` → `production`' )
698- expect ( markdown ) . toContain ( '**Tags.Team:** `DevOps` → (removed)' )
699- expect ( markdown ) . toContain ( '**Tags.UpdateType:** (added) → `InPlace`' )
700- expect ( markdown ) . toContain ( '**Tags.Version:** `v1` → `v2`' )
701- } )
702-
703- test ( 'diffs nested objects correctly' , ( ) => {
704- const changesSummary = JSON . stringify ( {
705- changes : [
706- {
707- Type : 'Resource' ,
708- ResourceChange : {
709- Action : 'Modify' ,
710- LogicalResourceId : 'MyResource' ,
711- ResourceType : 'AWS::Custom::Resource' ,
712- Replacement : 'False' ,
713- Scope : [ 'Properties' ] ,
714- Details : [
715- {
716- Target : {
717- Attribute : 'Properties' ,
718- Name : 'Config' ,
719- RequiresRecreation : 'Never' ,
720- BeforeValue : JSON . stringify ( {
721- Setting : 'old' ,
722- Nested : { Value : 'a' }
723- } ) ,
724- AfterValue : JSON . stringify ( {
725- Setting : 'new' ,
726- Nested : { Value : 'b' }
727- } )
728- }
729- }
730- ]
731- }
732- }
733- ] ,
734- totalChanges : 1 ,
735- truncated : false
736- } )
737-
738- const markdown = generateChangeSetMarkdown ( changesSummary )
739-
740- expect ( markdown ) . toContain ( '**Config.Setting:** `old` → `new`' )
741- expect ( markdown ) . toContain ( '**Config.Nested.Value:** `a` → `b`' )
742- } )
743-
744- test ( 'handles generic arrays as JSON strings' , ( ) => {
745- const changesSummary = JSON . stringify ( {
746- changes : [
747- {
748- Type : 'Resource' ,
749- ResourceChange : {
750- Action : 'Modify' ,
751- LogicalResourceId : 'MyResource' ,
752- ResourceType : 'AWS::Custom::Resource' ,
753- Replacement : 'False' ,
754- Scope : [ 'Properties' ] ,
755- Details : [
756- {
757- Target : {
758- Attribute : 'Properties' ,
759- Name : 'Items' ,
760- RequiresRecreation : 'Never' ,
761- BeforeValue : JSON . stringify ( [ 'a' , 'b' ] ) ,
762- AfterValue : JSON . stringify ( [ 'a' , 'c' ] )
763- }
764- }
765- ]
766- }
767- }
768- ] ,
769- totalChanges : 1 ,
770- truncated : false
771- } )
772-
773- const markdown = generateChangeSetMarkdown ( changesSummary )
774-
775- expect ( markdown ) . toContain ( '**Items:**' )
776- expect ( markdown ) . toContain ( '["a","b"]' )
777- expect ( markdown ) . toContain ( '["a","c"]' )
778- } )
779-
780- test ( 'handles array additions and removals' , ( ) => {
781- const changesSummary = JSON . stringify ( {
782- changes : [
783- {
784- Type : 'Resource' ,
785- ResourceChange : {
786- Action : 'Modify' ,
787- LogicalResourceId : 'MyResource' ,
788- ResourceType : 'AWS::Custom::Resource' ,
789- Replacement : 'False' ,
790- Scope : [ 'Properties' ] ,
791- Details : [
792- {
793- Target : {
794- Attribute : 'Properties' ,
795- Name : 'NewList' ,
796- RequiresRecreation : 'Never' ,
797- AfterValue : JSON . stringify ( [ 'x' , 'y' ] )
798- }
799- } ,
800- {
801- Target : {
802- Attribute : 'Properties' ,
803- Name : 'OldList' ,
804- RequiresRecreation : 'Never' ,
805- BeforeValue : JSON . stringify ( [ 'a' , 'b' ] )
806- }
807- }
808- ]
809- }
810- }
811- ] ,
812- totalChanges : 1 ,
813- truncated : false
814- } )
815-
816- const markdown = generateChangeSetMarkdown ( changesSummary )
817-
818- expect ( markdown ) . toContain ( '**NewList:** (added) → `["x","y"]`' )
819- expect ( markdown ) . toContain ( '**OldList:** `["a","b"]` → (removed)' )
820- } )
821-
822- test ( 'handles primitive value additions and removals' , ( ) => {
823- const changesSummary = JSON . stringify ( {
824- changes : [
825- {
826- Type : 'Resource' ,
827- ResourceChange : {
828- Action : 'Modify' ,
829- LogicalResourceId : 'MyResource' ,
830- ResourceType : 'AWS::Custom::Resource' ,
831- Replacement : 'False' ,
832- Scope : [ 'Properties' ] ,
833- Details : [
834- {
835- Target : {
836- Attribute : 'Properties' ,
837- Name : 'NewProp' ,
838- RequiresRecreation : 'Never' ,
839- AfterValue : 'new-value'
840- }
841- } ,
842- {
843- Target : {
844- Attribute : 'Properties' ,
845- Name : 'OldProp' ,
846- RequiresRecreation : 'Never' ,
847- BeforeValue : 'old-value'
848- }
849- }
850- ]
851- }
852- }
853- ] ,
854- totalChanges : 1 ,
855- truncated : false
856- } )
857-
858- const markdown = generateChangeSetMarkdown ( changesSummary )
859-
860- expect ( markdown ) . toContain ( '**NewProp:** (added) → `new-value`' )
861- expect ( markdown ) . toContain ( '**OldProp:** `old-value` → (removed)' )
862- } )
863-
864657 test ( 'displays AfterContext for Add actions in console output' , ( ) => {
865658 const changesSummary = JSON . stringify ( {
866659 changes : [
0 commit comments