Skip to content

Commit

Permalink
moved test to s3 bucket helper test file
Browse files Browse the repository at this point in the history
  • Loading branch information
mickychetta committed Nov 2, 2021
1 parent a37a678 commit b895d90
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/

import { KinesisFirehoseToS3, KinesisFirehoseToS3Props } from "../lib";
import { ResourcePart } from '@aws-cdk/assert';
import * as cdk from '@aws-cdk/core';
import * as s3 from '@aws-cdk/aws-s3';
import '@aws-cdk/assert/jest';
Expand Down Expand Up @@ -305,25 +304,4 @@ test('s3 bucket with one content bucket and no logging bucket', () => {
});

expect(stack).toCountResources("AWS::S3::Bucket", 1);
});

test('test s3Bucket removalPolicy override', () => {
const stack = new cdk.Stack();

new KinesisFirehoseToS3(stack, 'kinsisfirehose-s3', {
kinesisFirehoseProps: {
deliveryStreamType: 'KinesisStreamAsSource'
},
bucketProps: {
removalPolicy: cdk.RemovalPolicy.DESTROY,
},
});
expect(stack).toHaveResourceLike("AWS::S3::Bucket", {
Type: 'AWS::S3::Bucket',
Properties: {
AccessControl: "LogDeliveryWrite"
},
UpdateReplacePolicy: "Delete",
DeletionPolicy: "Delete"
}, ResourcePart.CompleteDefinition);
});
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,22 @@ test('Suppress cfn-nag warning for s3 bucket notification', () => {
}
}, ResourcePart.CompleteDefinition));
});

test('test s3Bucket removalPolicy override', () => {
const stack = new Stack();

defaults.buildS3Bucket(stack, {
bucketProps: {
removalPolicy: RemovalPolicy.DESTROY,
},
}, 'test-bucket');

expect(stack).toHaveResourceLike("AWS::S3::Bucket", {
Type: 'AWS::S3::Bucket',
Properties: {
AccessControl: "LogDeliveryWrite"
},
UpdateReplacePolicy: "Delete",
DeletionPolicy: "Delete"
}, ResourcePart.CompleteDefinition);
});

0 comments on commit b895d90

Please sign in to comment.