@@ -16,13 +16,15 @@ describe('Attribute Group', () => {
16
16
} ) ;
17
17
18
18
test ( 'default attribute group creation' , ( ) => {
19
- new appreg . AttributeGroup ( stack , 'MyAttributeGroup' , {
19
+ const attributeGroup = new appreg . AttributeGroup ( stack , 'MyAttributeGroup' , {
20
20
attributeGroupName : 'testAttributeGroup' ,
21
21
attributes : {
22
22
key : 'value' ,
23
23
} ,
24
24
} ) ;
25
25
26
+ expect ( attributeGroup . attributes ) . toEqual ( { key : 'value' } ) ;
27
+
26
28
Template . fromStack ( stack ) . templateMatches ( {
27
29
Resources : {
28
30
MyAttributeGroup99099500 : {
@@ -78,6 +80,21 @@ describe('Attribute Group', () => {
78
80
expect ( attributeGroup . attributeGroupId ) . toEqual ( '0aqmvxvgmry0ecc4mjhwypun6i' ) ;
79
81
} ) ,
80
82
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
+
81
98
test ( 'Associate an application to an imported attribute group' , ( ) => {
82
99
const attributeGroup = appreg . AttributeGroup . fromAttributeGroupArn ( stack , 'MyAttributeGroup' ,
83
100
'arn:aws:servicecatalog:us-east-1:123456789012:/attribute-groups/0aqmvxvgmry0ecc4mjhwypun6i' ) ;
0 commit comments