@@ -115,7 +115,7 @@ describe('ResourceStateCompletionProvider', () => {
115115 } ) ;
116116
117117 mockComponents . schemaRetriever . getDefault . returns ( s3Schemas ) ;
118- mockComponents . resourceStateManager . getResource . rejects ( new Error ( 'Resource not found' ) ) ;
118+ mockComponents . resourceStateManager . getResource . resolves ( { error : 'Resource not found' } ) ;
119119
120120 const result = await provider . getCompletions ( context , mockYamlParams ) ;
121121
@@ -152,14 +152,16 @@ describe('ResourceStateCompletionProvider', () => {
152152 emptySchemas . schemas . set ( 'Custom::Type' , customTypeSchema ) ;
153153 mockComponents . schemaRetriever . getDefault . returns ( emptySchemas ) ;
154154 mockComponents . resourceStateManager . getResource . resolves ( {
155- typeName : 'Custom::Type' ,
156- identifier : 'test' ,
157- properties : JSON . stringify ( {
158- BucketName : 'test' ,
159- VersioningConfiguration : { Status : 'Enabled' } ,
160- ExistingProp : 'value' ,
161- } ) ,
162- createdTimestamp : new Date ( ) as any ,
155+ resource : {
156+ typeName : 'Custom::Type' ,
157+ identifier : 'test' ,
158+ properties : JSON . stringify ( {
159+ BucketName : 'test' ,
160+ VersioningConfiguration : { Status : 'Enabled' } ,
161+ ExistingProp : 'value' ,
162+ } ) ,
163+ createdTimestamp : new Date ( ) as any ,
164+ } ,
163165 } ) ;
164166
165167 const result = await provider . getCompletions ( context , mockYamlParams ) ;
@@ -187,13 +189,15 @@ describe('ResourceStateCompletionProvider', () => {
187189 emptySchemas . schemas . set ( 'Custom::Type' , customTypeSchema ) ;
188190 mockComponents . schemaRetriever . getDefault . returns ( emptySchemas ) ;
189191 mockComponents . resourceStateManager . getResource . resolves ( {
190- typeName : 'Custom::Type' ,
191- identifier : 'test' ,
192- properties : JSON . stringify ( {
193- BucketName : 'test' ,
194- VersioningConfiguration : { Status : 'Enabled' } ,
195- } ) ,
196- createdTimestamp : new Date ( ) as any ,
192+ resource : {
193+ typeName : 'Custom::Type' ,
194+ identifier : 'test' ,
195+ properties : JSON . stringify ( {
196+ BucketName : 'test' ,
197+ VersioningConfiguration : { Status : 'Enabled' } ,
198+ } ) ,
199+ createdTimestamp : new Date ( ) as any ,
200+ } ,
197201 } ) ;
198202
199203 const result = await provider . getCompletions ( context , mockYamlParams ) ;
@@ -268,10 +272,12 @@ describe('ResourceStateCompletionProvider', () => {
268272 } ) ;
269273
270274 mockComponents . resourceStateManager . getResource . resolves ( {
271- typeName : 'AWS::IAM::Role' ,
272- identifier : 'Admin' ,
273- properties : `{"Path":"/","ManagedPolicyArns":["arn:aws:iam::aws:policy/AdministratorAccess"],"MaxSessionDuration":43200,"RoleName":"Admin","AssumeRolePolicyDocument":{"Version":"2012-10-17","Statement":[{"Condition":{"StringEquals":{"sts:ExternalId":"IsengardExternalIdAKj8duTfSqL6"}},"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::727820809195:root"},"Sid":""}]},"Arn":"arn:aws:iam::783764615233:role/Admin","RoleId":"AROA3M7AC6BAWIZG2LLQY"}` ,
274- createdTimestamp : DateTime . now ( ) ,
275+ resource : {
276+ typeName : 'AWS::IAM::Role' ,
277+ identifier : 'Admin' ,
278+ properties : `{"Path":"/","ManagedPolicyArns":["arn:aws:iam::aws:policy/AdministratorAccess"],"MaxSessionDuration":43200,"RoleName":"Admin","AssumeRolePolicyDocument":{"Version":"2012-10-17","Statement":[{"Condition":{"StringEquals":{"sts:ExternalId":"IsengardExternalIdAKj8duTfSqL6"}},"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::727820809195:root"},"Sid":""}]},"Arn":"arn:aws:iam::783764615233:role/Admin","RoleId":"AROA3M7AC6BAWIZG2LLQY"}` ,
279+ createdTimestamp : DateTime . now ( ) ,
280+ } ,
275281 } ) ;
276282
277283 const result = await provider . getCompletions ( context , mockJsonParams ) ;
@@ -307,10 +313,12 @@ describe('ResourceStateCompletionProvider', () => {
307313 } ) ;
308314
309315 mockComponents . resourceStateManager . getResource . resolves ( {
310- typeName : 'AWS::IAM::Role' ,
311- identifier : 'Admin' ,
312- properties : `{"Path":"/","ManagedPolicyArns":["arn:aws:iam::aws:policy/AdministratorAccess"],"MaxSessionDuration":43200,"RoleName":"Admin","AssumeRolePolicyDocument":{"Version":"2012-10-17","Statement":[{"Condition":{"StringEquals":{"sts:ExternalId":"IsengardExternalIdAKj8duTfSqL6"}},"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::727820809195:root"},"Sid":""}]},"Arn":"arn:aws:iam::783764615233:role/Admin","RoleId":"AROA3M7AC6BAWIZG2LLQY"}` ,
313- createdTimestamp : DateTime . now ( ) ,
316+ resource : {
317+ typeName : 'AWS::IAM::Role' ,
318+ identifier : 'Admin' ,
319+ properties : `{"Path":"/","ManagedPolicyArns":["arn:aws:iam::aws:policy/AdministratorAccess"],"MaxSessionDuration":43200,"RoleName":"Admin","AssumeRolePolicyDocument":{"Version":"2012-10-17","Statement":[{"Condition":{"StringEquals":{"sts:ExternalId":"IsengardExternalIdAKj8duTfSqL6"}},"Action":"sts:AssumeRole","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::727820809195:root"},"Sid":""}]},"Arn":"arn:aws:iam::783764615233:role/Admin","RoleId":"AROA3M7AC6BAWIZG2LLQY"}` ,
320+ createdTimestamp : DateTime . now ( ) ,
321+ } ,
314322 } ) ;
315323
316324 const result = await provider . getCompletions ( context , mockYamlParams ) ;
@@ -459,13 +467,15 @@ describe('ResourceStateCompletionProvider', () => {
459467 emptySchemas . schemas . set ( 'Custom::Type' , customTypeSchema ) ;
460468 mockComponents . schemaRetriever . getDefault . returns ( emptySchemas ) ;
461469 mockComponents . resourceStateManager . getResource . resolves ( {
462- typeName : 'Custom::Type' ,
463- identifier : 'test' ,
464- properties : JSON . stringify ( {
465- BucketName : 'test' ,
466- VersioningConfiguration : { Status : 'Enabled' } ,
467- } ) ,
468- createdTimestamp : new Date ( ) as any ,
470+ resource : {
471+ typeName : 'Custom::Type' ,
472+ identifier : 'test' ,
473+ properties : JSON . stringify ( {
474+ BucketName : 'test' ,
475+ VersioningConfiguration : { Status : 'Enabled' } ,
476+ } ) ,
477+ createdTimestamp : new Date ( ) as any ,
478+ } ,
469479 } ) ;
470480
471481 const result = await provider . getCompletions ( context , mockYamlParams ) ;
@@ -490,13 +500,15 @@ describe('ResourceStateCompletionProvider', () => {
490500 mockComponents . schemaRetriever . getDefault . returns ( emptySchemas ) ;
491501 mockComponents . documentManager . getLine . returns ( '"",' ) ;
492502 mockComponents . resourceStateManager . getResource . resolves ( {
493- typeName : 'Custom::Type' ,
494- identifier : 'test' ,
495- properties : JSON . stringify ( {
496- BucketName : 'test' ,
497- VersioningConfiguration : { Status : 'Enabled' } ,
498- } ) ,
499- createdTimestamp : new Date ( ) as any ,
503+ resource : {
504+ typeName : 'Custom::Type' ,
505+ identifier : 'test' ,
506+ properties : JSON . stringify ( {
507+ BucketName : 'test' ,
508+ VersioningConfiguration : { Status : 'Enabled' } ,
509+ } ) ,
510+ createdTimestamp : new Date ( ) as any ,
511+ } ,
500512 } ) ;
501513
502514 const result = await provider . getCompletions ( context , mockJsonParams ) ;
0 commit comments