From c4e17956459140bc74d53ad022a3e5dc35ccfc64 Mon Sep 17 00:00:00 2001 From: Sumu Date: Wed, 23 Oct 2024 10:49:08 -0400 Subject: [PATCH] WIP - add unit test to synthesis.test.ts Signed-off-by: Sumu --- .../aws-cdk-lib/core/test/synthesis.test.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/aws-cdk-lib/core/test/synthesis.test.ts b/packages/aws-cdk-lib/core/test/synthesis.test.ts index 8b67b371e0be8..bdfb607a582d8 100644 --- a/packages/aws-cdk-lib/core/test/synthesis.test.ts +++ b/packages/aws-cdk-lib/core/test/synthesis.test.ts @@ -6,6 +6,7 @@ import { Construct } from 'constructs'; import * as cxschema from '../../cloud-assembly-schema'; import * as cxapi from '../../cx-api'; import * as cdk from '../lib'; +import { Template } from '../../assertions'; import { synthesize } from '../lib/private/synthesis'; function createModernApp() { @@ -362,6 +363,26 @@ describe('synthesis', () => { }); + test('can call synth multiple times without caching assembly', () => { + const app = new cdk.App(); + + const stages = [ + { + stage: 'PROD', + }, + { + stage: 'BETA', + }, + ]; + + stages.forEach(({ stage }) => { + const stack = new cdk.Stack(app, `${stage}-Stack`, {}); + // Assert that `Unable to find artifact with id` error is not thrown + expect(() => { + Template.fromStack(stack); + }).not.toThrow(); + }); + }); }); function list(outdir: string) {