Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
onhate committed Mar 11, 2024
1 parent 567adf5 commit d62dd4b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/aws-cdk/test/api/logs/find-cloudwatch-logs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,32 @@ test('add log groups from lambda function', async () => {
expect(result.logGroupNames).toEqual(['/aws/lambda/my-function']);
});

test('add log groups from lambda function when using custom LoggingConfig', async () => {
// GIVEN
const cdkStackArtifact = cdkStackArtifactOf({
template: {
Resources: {
Func: {
Type: 'AWS::Lambda::Function',
Properties: {
FunctionName: 'my-function',
LoggingConfig: {
LogGroupName: '/this/custom/my-custom-log-group',
},
},
},
},
},
});
pushStackResourceSummaries(stackSummaryOf('Func', 'AWS::Lambda::Function', 'my-function'));

// WHEN
const result = await findCloudWatchLogGroups(logsMockSdkProvider.mockSdkProvider, cdkStackArtifact);

// THEN
expect(result.logGroupNames).toEqual(['/this/custom/my-custom-log-group']);
});

test('add log groups from lambda function without physical name', async () => {
// GIVEN
const cdkStackArtifact = cdkStackArtifactOf({
Expand Down

0 comments on commit d62dd4b

Please # to comment.