@@ -113,13 +113,19 @@ describe('synthesis', () => {
113113 const stack = new cdk . Stack ( app , 'one-stack' ) ;
114114
115115 class MyConstruct extends Construct {
116- protected synthesize ( s : cdk . ISynthesisSession ) {
117- writeJson ( s . assembly . outdir , 'foo.json' , { bar : 123 } ) ;
118- s . assembly . addArtifact ( 'my-random-construct' , {
119- type : cxschema . ArtifactType . AWS_CLOUDFORMATION_STACK ,
120- environment : 'aws://12345/bar' ,
121- properties : {
122- templateFile : 'foo.json' ,
116+ constructor ( scope : Construct , id : string ) {
117+ super ( scope , id ) ;
118+
119+ cdk . attachCustomSynthesis ( this , {
120+ onSynthesize ( s : cdk . ISynthesisSession ) {
121+ writeJson ( s . assembly . outdir , 'foo.json' , { bar : 123 } ) ;
122+ s . assembly . addArtifact ( 'my-random-construct' , {
123+ type : cxschema . ArtifactType . AWS_CLOUDFORMATION_STACK ,
124+ environment : 'aws://12345/bar' ,
125+ properties : {
126+ templateFile : 'foo.json' ,
127+ } ,
128+ } ) ;
123129 } ,
124130 } ) ;
125131 }
@@ -137,7 +143,7 @@ describe('synthesis', () => {
137143 expect ( readJson ( session . directory , 'foo.json' ) ) . toEqual ( { bar : 123 } ) ;
138144 expect ( session . manifest ) . toEqual ( {
139145 version : cxschema . Manifest . version ( ) ,
140- artifacts : {
146+ artifacts : expect . objectContaining ( {
141147 'Tree' : {
142148 type : 'cdk:tree' ,
143149 properties : { file : 'tree.json' } ,
@@ -147,16 +153,16 @@ describe('synthesis', () => {
147153 environment : 'aws://12345/bar' ,
148154 properties : { templateFile : 'foo.json' } ,
149155 } ,
150- 'one-stack' : {
156+ 'one-stack' : expect . objectContaining ( {
151157 type : 'aws:cloudformation:stack' ,
152158 environment : 'aws://unknown-account/unknown-region' ,
153- properties : {
159+ properties : expect . objectContaining ( {
154160 templateFile : 'one-stack.template.json' ,
155161 validateOnSynth : false ,
156- } ,
162+ } ) ,
157163 displayName : 'one-stack' ,
158- } ,
159- } ,
164+ } ) ,
165+ } ) ,
160166 } ) ;
161167 } ) ;
162168
0 commit comments