From 1ee1ddd07a00a4b346a6c3cc4bda758b1f76e44b Mon Sep 17 00:00:00 2001 From: Tatsuya Yamamoto Date: Thu, 11 Nov 2021 06:00:50 +0900 Subject: [PATCH] chore(iot-actions): clarify the test difference (#17451) This PR refactor the test that I committed earlier, and is based on the following comment. - https://github.com/aws/aws-cdk/pull/17307#discussion_r745890426 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../cloudwatch-logs-action.test.ts | 24 ++----------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/packages/@aws-cdk/aws-iot-actions/test/cloudwatch-logs/cloudwatch-logs-action.test.ts b/packages/@aws-cdk/aws-iot-actions/test/cloudwatch-logs/cloudwatch-logs-action.test.ts index 3b6ecd2d57fbc..4499cdd35d6f1 100644 --- a/packages/@aws-cdk/aws-iot-actions/test/cloudwatch-logs/cloudwatch-logs-action.test.ts +++ b/packages/@aws-cdk/aws-iot-actions/test/cloudwatch-logs/cloudwatch-logs-action.test.ts @@ -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'; @@ -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'], });