Skip to content

Commit accc5d2

Browse files
author
neha
committed
feat(aws-servicecatalogappregistry-alpha): add attributes property to AttributeGroup import
1 parent 6eb6ce9 commit accc5d2

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

packages/@aws-cdk/aws-servicecatalogappregistry-alpha/test/attribute-group.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ describe('Attribute Group', () => {
1616
});
1717

1818
test('default attribute group creation', () => {
19-
new appreg.AttributeGroup(stack, 'MyAttributeGroup', {
19+
const attributeGroup = new appreg.AttributeGroup(stack, 'MyAttributeGroup', {
2020
attributeGroupName: 'testAttributeGroup',
2121
attributes: {
2222
key: 'value',
2323
},
2424
});
2525

26+
expect(attributeGroup.attributes).toEqual({ key: 'value' });
27+
2628
Template.fromStack(stack).templateMatches({
2729
Resources: {
2830
MyAttributeGroup99099500: {
@@ -78,6 +80,21 @@ describe('Attribute Group', () => {
7880
expect(attributeGroup.attributeGroupId).toEqual('0aqmvxvgmry0ecc4mjhwypun6i');
7981
}),
8082

83+
test('for an attribute group imported by ARN with attributes', () => {
84+
const attributes = { key1: 'value1', key2: 'value2' };
85+
const attributeGroup = appreg.AttributeGroup.fromAttributeGroupArn(stack, 'MyAttributeGroup',
86+
'arn:aws:servicecatalog:us-east-1:123456789012:/attribute-groups/0aqmvxvgmry0ecc4mjhwypun6i', attributes);
87+
expect(attributeGroup.attributeGroupId).toEqual('0aqmvxvgmry0ecc4mjhwypun6i');
88+
expect(attributeGroup.attributes).toEqual(attributes);
89+
}),
90+
91+
test('for an attribute group imported by ARN without attributes', () => {
92+
const attributeGroup = appreg.AttributeGroup.fromAttributeGroupArn(stack, 'MyAttributeGroup',
93+
'arn:aws:servicecatalog:us-east-1:123456789012:/attribute-groups/0aqmvxvgmry0ecc4mjhwypun6i');
94+
expect(attributeGroup.attributeGroupId).toEqual('0aqmvxvgmry0ecc4mjhwypun6i');
95+
expect(attributeGroup.attributes).toBeUndefined();
96+
}),
97+
8198
test('Associate an application to an imported attribute group', () => {
8299
const attributeGroup = appreg.AttributeGroup.fromAttributeGroupArn(stack, 'MyAttributeGroup',
83100
'arn:aws:servicecatalog:us-east-1:123456789012:/attribute-groups/0aqmvxvgmry0ecc4mjhwypun6i');

0 commit comments

Comments
 (0)