(missingTag, tagValue)
| 41 | |
| 42 | // Create replication configuration XML with an tag optionally omitted. |
| 43 | function createReplicationXML(missingTag, tagValue) { |
| 44 | let Role = missingTag === 'Role' ? '' : |
| 45 | '<Role>' + |
| 46 | 'arn:aws:iam::account-id:role/src-resource,' + |
| 47 | 'arn:aws:iam::account-id:role/dest-resource' + |
| 48 | '</Role>'; |
| 49 | Role = tagValue && tagValue.Role ? `<Role>${tagValue.Role}</Role>` : Role; |
| 50 | let ID = missingTag === 'ID' ? '' : '<ID>foo</ID>'; |
| 51 | ID = tagValue && tagValue.ID === '' ? '<ID/>' : ID; |
| 52 | const Prefix = missingTag === 'Prefix' ? '' : '<Prefix>foo</Prefix>'; |
| 53 | const Status = missingTag === 'Status' ? '' : '<Status>Enabled</Status>'; |
| 54 | const Bucket = missingTag === 'Bucket' ? '' : |
| 55 | '<Bucket>arn:aws:s3:::destination-bucket</Bucket>'; |
| 56 | let StorageClass = missingTag === 'StorageClass' ? '' : |
| 57 | '<StorageClass>STANDARD</StorageClass>'; |
| 58 | StorageClass = tagValue && tagValue.StorageClass ? |
| 59 | `<StorageClass>${tagValue.StorageClass}</StorageClass>` : StorageClass; |
| 60 | const Destination = missingTag === 'Destination' ? '' : |
| 61 | `<Destination>${Bucket + StorageClass}</Destination>`; |
| 62 | const Rule = missingTag === 'Rule' ? '' : |
| 63 | `<Rule>${ID + Prefix + Status + Destination}</Rule>`; |
| 64 | const content = missingTag === null ? '' : `${Role}${Rule}`; |
| 65 | return '<ReplicationConfiguration ' + |
| 66 | `xmlns="http://s3.amazonaws.com/doc/2006-03-01/">${content}` + |
| 67 | '</ReplicationConfiguration>'; |
| 68 | } |
| 69 | |
| 70 | describe('\'getReplicationConfiguration\' function', () => { |
| 71 | it('should not return error when putting valid XML', done => |
no outgoing calls
no test coverage detected