Skip to content

Commit

Permalink
Improve Storage tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Jul 9, 2021
1 parent 7133ed4 commit 371affa
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion test/unit/storage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,52 @@ describe("storage", () => {
configExt: pluginConfigExt,
command: "package",
});
expect(cfTemplate.Resources[computeLogicalId("avatars", "Bucket")]).toMatchObject({
const bucketId = computeLogicalId("avatars", "Bucket");
expect(Object.keys(cfTemplate.Resources)).toStrictEqual([
"ServerlessDeploymentBucket",
"ServerlessDeploymentBucketPolicy",
bucketId,
computeLogicalId("avatars", "Bucket", "Policy"),
]);
expect(cfTemplate.Resources[bucketId]).toStrictEqual({
Type: "AWS::S3::Bucket",
UpdateReplacePolicy: "Retain",
DeletionPolicy: "Retain",
Properties: {
BucketEncryption: {
ServerSideEncryptionConfiguration: [
{
ServerSideEncryptionByDefault: { SSEAlgorithm: "AES256" },
},
],
},
LifecycleConfiguration: {
Rules: [
{
Status: "Enabled",
Transitions: [
{
StorageClass: "INTELLIGENT_TIERING",
TransitionInDays: 0,
},
],
},
{
NoncurrentVersionExpirationInDays: 30,
Status: "Enabled",
},
],
},
PublicAccessBlockConfiguration: {
BlockPublicAcls: true,
BlockPublicPolicy: true,
IgnorePublicAcls: true,
RestrictPublicBuckets: true,
},
VersioningConfiguration: {
Status: "Enabled",
},
},
});
});
});

0 comments on commit 371affa

Please sign in to comment.