From 766a4310c16e3ff29408fcb21535b7817108eb5e Mon Sep 17 00:00:00 2001 From: go-to-k <24818752+go-to-k@users.noreply.github.com> Date: Fri, 7 Mar 2025 17:16:49 +0900 Subject: [PATCH] unit test --- .../aws-cdk-lib/core/test/annotations.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/aws-cdk-lib/core/test/annotations.test.ts b/packages/aws-cdk-lib/core/test/annotations.test.ts index 22440c49c4339..ff500152c0d73 100644 --- a/packages/aws-cdk-lib/core/test/annotations.test.ts +++ b/packages/aws-cdk-lib/core/test/annotations.test.ts @@ -129,4 +129,22 @@ describe('annotations', () => { // THEN expect(getWarnings(app.synth())).toEqual([]); }); + + test('don\'t resolve the message if tokens are included', () => { + // GIVEN + const app = new App(); + const stack = new Stack(app, 'S1'); + const c1 = new Construct(stack, 'C1'); + + // WHEN + Annotations.of(c1).addWarningV2('MESSAGE', `stackId: ${stack.stackId}`); + + // THEN + expect(getWarnings(app.synth())).toEqual([ + { + path: '/S1/C1', + message: expect.stringMatching(/stackId: \${Token\[AWS::StackId\.\d+\]} \[ack: MESSAGE\]/), + }, + ]); + }); });