Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check default properties in OriginAccessControl in unit test #2

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Template } from '../../assertions';
import { Stack } from '../../core';
import { Names, Stack } from '../../core';
import { S3OriginAccessControl, SigningBehavior, SigningProtocol, OriginAccessControlOriginType, Signing } from '../lib';

describe('S3OriginAccessControl', () => {
Expand All @@ -10,9 +10,20 @@ describe('S3OriginAccessControl', () => {
});

test('creates an S3OriginAccessControl with default properties', () => {
new S3OriginAccessControl(stack, 'DefaultS3OriginAccessControl');
const oac = new S3OriginAccessControl(stack, 'DefaultS3OriginAccessControl');

Template.fromStack(stack).resourceCountIs('AWS::CloudFront::OriginAccessControl', 1);
const template = Template.fromStack(stack);
template.resourceCountIs('AWS::CloudFront::OriginAccessControl', 1);
template.hasResourceProperties('AWS::CloudFront::OriginAccessControl', {
OriginAccessControlConfig: {
Name: Names.uniqueResourceName(oac, {
maxLength: 64,
}),
SigningBehavior: SigningBehavior.ALWAYS,
SigningProtocol: SigningProtocol.SIGV4,
OriginAccessControlOriginType: OriginAccessControlOriginType.S3,
},
});
});

test('creates an OriginAccessControl with custom properties', () => {
Expand Down
Loading