INFRA-3085 | Saqib | Format the code
This commit is contained in:
@@ -56,15 +56,24 @@ describe('Change request test', () => {
|
||||
},
|
||||
extraResources: {
|
||||
s3_buckets: {
|
||||
"bucketTag" : "test-bucket",
|
||||
"corsPolicy" : [],
|
||||
"isDeployed" : false,
|
||||
"bucketPolicy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Principal\": \"*\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::your-bucket-name/*\"\n }\n ]\n}",
|
||||
"bucketTag": "test-bucket",
|
||||
"corsPolicy": [],
|
||||
"isDeployed": false,
|
||||
"bucketPolicy": `{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": "*",
|
||||
"Action": "s3:GetObject",
|
||||
"Resource": "arn:aws:s3:::your-bucket-name/*"
|
||||
}
|
||||
]
|
||||
}`,
|
||||
"lifecycleRules": [],
|
||||
"enableAccessLog": false,
|
||||
"enablePublicBucket": false,
|
||||
"anonymizedBucketName": "test-bucket"
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -326,13 +335,22 @@ describe('Change request test', () => {
|
||||
it('when diff in s3 policy', () =>{
|
||||
const preS3ManifestObject = _.cloneDeep(sampleManifestObject);
|
||||
const s3ManifestObject = _.cloneDeep(sampleManifestObject);
|
||||
const bucketPolicyCR = "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Deny\",\n \"Principal\": \"*\",\n \"Action\": \"s3:GetObject\",\n \"Resource\": \"arn:aws:s3:::your-bucket-name/*\"\n }\n ]\n}"
|
||||
|
||||
const bucketPolicyCR = `{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Deny",
|
||||
"Principal": "*",
|
||||
"Action": "s3:GetObject",
|
||||
"Resource": "arn:aws:s3:::your-bucket-name/*"
|
||||
}
|
||||
]
|
||||
}`;
|
||||
const limitObject = {
|
||||
extraResources: {
|
||||
s3_buckets: {
|
||||
bucketPolicy: {
|
||||
approvalFrom: ['Infra'],
|
||||
approvalFrom: ['Security'],
|
||||
textDiff: true,
|
||||
}
|
||||
},
|
||||
@@ -341,14 +359,14 @@ describe('Change request test', () => {
|
||||
|
||||
s3ManifestObject.extraResources.s3_buckets.bucketPolicy = bucketPolicyCR;
|
||||
const actual = getBreachedValues(limitObject, s3ManifestObject, preS3ManifestObject);
|
||||
const expected = [
|
||||
{
|
||||
op: 'replace',
|
||||
path: '/extraResources/s3_buckets/bucketPolicy',
|
||||
limitPath: '/extraResources/s3_buckets/bucketPolicy',
|
||||
value: bucketPolicyCR,
|
||||
}
|
||||
]
|
||||
const expected = [
|
||||
{
|
||||
op: 'replace',
|
||||
path: '/extraResources/s3_buckets/bucketPolicy',
|
||||
limitPath: '/extraResources/s3_buckets/bucketPolicy',
|
||||
value: bucketPolicyCR,
|
||||
}
|
||||
]
|
||||
expect(actual).toStrictEqual(expected);
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user