Skip to content

Commit

Permalink
unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
go-to-k committed Mar 7, 2025
1 parent 68f2cb5 commit 766a431
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/aws-cdk-lib/core/test/annotations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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\]/),
},
]);
});
});

0 comments on commit 766a431

Please # to comment.