@@ -493,73 +493,13 @@ describe('CfnService', () => {
493493
494494 const result = await service . listStackResources ( {
495495 StackName : TEST_CONSTANTS . STACK_NAME ,
496+ NextToken : 'token123' ,
497+ MaxItems : 10 ,
496498 } ) ;
497499
498500 expect ( result ) . toEqual ( MOCK_RESPONSES . LIST_STACK_RESOURCES ) ;
499501 } ) ;
500502
501- it ( 'should handle pagination and collect all resources' , async ( ) => {
502- const page1 = {
503- ...MOCK_RESPONSES . LIST_STACK_RESOURCES ,
504- StackResourceSummaries : [
505- {
506- LogicalResourceId : 'Resource1' ,
507- ResourceType : 'AWS::S3::Bucket' ,
508- LastUpdatedTimestamp : new Date ( ) ,
509- ResourceStatus : 'CREATE_COMPLETE' as const ,
510- } ,
511- {
512- LogicalResourceId : 'Resource2' ,
513- ResourceType : 'AWS::S3::Bucket' ,
514- LastUpdatedTimestamp : new Date ( ) ,
515- ResourceStatus : 'CREATE_COMPLETE' as const ,
516- } ,
517- ] ,
518- NextToken : 'token1' ,
519- } ;
520- const page2 = {
521- ...MOCK_RESPONSES . LIST_STACK_RESOURCES ,
522- StackResourceSummaries : [
523- {
524- LogicalResourceId : 'Resource3' ,
525- ResourceType : 'AWS::S3::Bucket' ,
526- LastUpdatedTimestamp : new Date ( ) ,
527- ResourceStatus : 'CREATE_COMPLETE' as const ,
528- } ,
529- ] ,
530- NextToken : undefined ,
531- } ;
532-
533- cloudFormationMock . on ( ListStackResourcesCommand ) . resolvesOnce ( page1 ) . resolvesOnce ( page2 ) ;
534-
535- const result = await service . listStackResources ( {
536- StackName : TEST_CONSTANTS . STACK_NAME ,
537- } ) ;
538-
539- expect ( result . StackResourceSummaries ) . toHaveLength ( 3 ) ;
540- expect ( result . StackResourceSummaries ) . toEqual ( [
541- {
542- LogicalResourceId : 'Resource1' ,
543- ResourceType : 'AWS::S3::Bucket' ,
544- LastUpdatedTimestamp : expect . any ( Date ) ,
545- ResourceStatus : 'CREATE_COMPLETE' as const ,
546- } ,
547- {
548- LogicalResourceId : 'Resource2' ,
549- ResourceType : 'AWS::S3::Bucket' ,
550- LastUpdatedTimestamp : expect . any ( Date ) ,
551- ResourceStatus : 'CREATE_COMPLETE' as const ,
552- } ,
553- {
554- LogicalResourceId : 'Resource3' ,
555- ResourceType : 'AWS::S3::Bucket' ,
556- LastUpdatedTimestamp : expect . any ( Date ) ,
557- ResourceStatus : 'CREATE_COMPLETE' as const ,
558- } ,
559- ] ) ;
560- expect ( result . NextToken ) . toBeUndefined ( ) ;
561- } ) ;
562-
563503 it ( 'should throw StackNotFoundException when API call fails' , async ( ) => {
564504 const error = createStackNotFoundError ( ) ;
565505 cloudFormationMock . on ( ListStackResourcesCommand ) . rejects ( error ) ;
0 commit comments