Skip to content

Commit

Permalink
chore(iot-actions): clarify the test difference (aws#17451)
Browse files Browse the repository at this point in the history
This PR refactor the test that I committed earlier, and is based on the following comment.

- aws#17307 (comment)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
yamatatsu authored and TikiTDO committed Feb 21, 2022
1 parent e6fe08d commit 1ee1ddd
Showing 1 changed file with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Template } from '@aws-cdk/assertions';
import { Template, Match } from '@aws-cdk/assertions';
import * as iam from '@aws-cdk/aws-iam';
import * as iot from '@aws-cdk/aws-iot';
import * as logs from '@aws-cdk/aws-logs';
Expand Down Expand Up @@ -95,32 +95,12 @@ test('can set role', () => {
Template.fromStack(stack).hasResourceProperties('AWS::IoT::TopicRule', {
TopicRulePayload: {
Actions: [
{
CloudwatchLogs: {
LogGroupName: 'my-log-group',
RoleArn: 'arn:aws:iam::123456789012:role/ForTest',
},
},
Match.objectLike({ CloudwatchLogs: { RoleArn: 'arn:aws:iam::123456789012:role/ForTest' } }),
],
},
});

Template.fromStack(stack).hasResourceProperties('AWS::IAM::Policy', {
PolicyDocument: {
Statement: [
{
Action: ['logs:CreateLogStream', 'logs:PutLogEvents'],
Effect: 'Allow',
Resource: 'arn:aws:logs:us-east-1:123456789012:log-group:my-log-group:*',
},
{
Action: 'logs:DescribeLogStreams',
Effect: 'Allow',
Resource: 'arn:aws:logs:us-east-1:123456789012:log-group:my-log-group:*',
},
],
Version: '2012-10-17',
},
PolicyName: 'MyRolePolicy64AB00A5',
Roles: ['ForTest'],
});
Expand Down

0 comments on commit 1ee1ddd

Please sign in to comment.