Skip to content

Commit

Permalink
chore(ses-actions): migrated tests to assertions (#18472)
Browse files Browse the repository at this point in the history
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
otaviomacedo authored Jan 18, 2022
1 parent d8c11fe commit 438511d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ses-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert-internal": "0.0.0",
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
Expand Down
29 changes: 14 additions & 15 deletions packages/@aws-cdk/aws-ses-actions/test/actions.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { arrayWith, ResourcePart } from '@aws-cdk/assert-internal';
import '@aws-cdk/assert-internal/jest';
import { Match, Template } from '@aws-cdk/assertions';
import * as kms from '@aws-cdk/aws-kms';
import * as lambda from '@aws-cdk/aws-lambda';
import * as s3 from '@aws-cdk/aws-s3';
Expand All @@ -25,7 +24,7 @@ test('add header action', () => {
value: 'value',
}));

expect(stack).toHaveResource('AWS::SES::ReceiptRule', {
Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', {
Rule: {
Actions: [
{
Expand Down Expand Up @@ -62,7 +61,7 @@ test('add bounce action', () => {
topic,
}));

expect(stack).toHaveResource('AWS::SES::ReceiptRule', {
Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', {
Rule: {
Actions: [
{
Expand Down Expand Up @@ -95,7 +94,7 @@ test('add lambda action', () => {
topic,
}));

expect(stack).toHaveResource('AWS::SES::ReceiptRule', {
Template.fromStack(stack).hasResource('AWS::SES::ReceiptRule', {
Properties: {
Rule: {
Actions: [
Expand Down Expand Up @@ -123,9 +122,9 @@ test('add lambda action', () => {
DependsOn: [
'FunctionAllowSes1829904A',
],
}, ResourcePart.CompleteDefinition);
});

expect(stack).toHaveResource('AWS::Lambda::Permission', {
Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', {
Action: 'lambda:InvokeFunction',
FunctionName: {
'Fn::GetAtt': [
Expand All @@ -151,7 +150,7 @@ test('add s3 action', () => {
topic,
}));

expect(stack).toHaveResource('AWS::SES::ReceiptRule', {
Template.fromStack(stack).hasResource('AWS::SES::ReceiptRule', {
Properties: {
Rule: {
Actions: [
Expand Down Expand Up @@ -182,9 +181,9 @@ test('add s3 action', () => {
DependsOn: [
'BucketPolicyE9A3008A',
],
}, ResourcePart.CompleteDefinition);
});

expect(stack).toHaveResource('AWS::S3::BucketPolicy', {
Template.fromStack(stack).hasResourceProperties('AWS::S3::BucketPolicy', {
Bucket: {
Ref: 'Bucket83908E77',
},
Expand Down Expand Up @@ -223,9 +222,9 @@ test('add s3 action', () => {
},
});

expect(stack).toHaveResourceLike('AWS::KMS::Key', {
Template.fromStack(stack).hasResourceProperties('AWS::KMS::Key', {
KeyPolicy: {
Statement: arrayWith({
Statement: Match.arrayWith([{
Action: [
'kms:Encrypt',
'kms:GenerateDataKey',
Expand All @@ -246,7 +245,7 @@ test('add s3 action', () => {
Service: 'ses.amazonaws.com',
},
Resource: '*',
}),
}]),
},
});
});
Expand All @@ -257,7 +256,7 @@ test('add sns action', () => {
topic,
}));

expect(stack).toHaveResource('AWS::SES::ReceiptRule', {
Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', {
Rule: {
Actions: [
{
Expand All @@ -279,7 +278,7 @@ test('add stop action', () => {
topic,
}));

expect(stack).toHaveResource('AWS::SES::ReceiptRule', {
Template.fromStack(stack).hasResourceProperties('AWS::SES::ReceiptRule', {
Rule: {
Actions: [
{
Expand Down

0 comments on commit 438511d

Please sign in to comment.