@@ -506,6 +506,47 @@ describe('list API', () => {
506
506
} ,
507
507
) ;
508
508
509
+ it . each ( pathTestCases ) (
510
+ 'should list objects with CommonPrefix and nextToken in results with custom path: $path' ,
511
+ async ( { path } ) => {
512
+ mockListObject . mockImplementationOnce ( ( ) => {
513
+ return {
514
+ CommonPrefixes : [
515
+ { Prefix : 'photos/2023/' } ,
516
+ { Prefix : 'photos/2024/' } ,
517
+ { Prefix : 'photos/2025/' } ,
518
+ { Prefix : 'photos/2026/' } ,
519
+ { Prefix : 'photos/2027/' } ,
520
+ { Prefix : 'photos/time-traveling/' } ,
521
+ ] ,
522
+ NextContinuationToken : 'yup_there_is_more' ,
523
+ } ;
524
+ } ) ;
525
+ const response = await listPaginatedWrapper ( {
526
+ path : resolvePath ( path ) ,
527
+ } ) ;
528
+ expect ( response . excludedSubpaths ) . toEqual ( [
529
+ 'photos/2023/' ,
530
+ 'photos/2024/' ,
531
+ 'photos/2025/' ,
532
+ 'photos/2026/' ,
533
+ 'photos/2027/' ,
534
+ 'photos/time-traveling/' ,
535
+ ] ) ;
536
+
537
+ expect ( response . nextToken ) . toEqual ( 'yup_there_is_more' ) ;
538
+ expect ( listObjectsV2 ) . toHaveBeenCalledTimes ( 1 ) ;
539
+ await expect ( listObjectsV2 ) . toBeLastCalledWithConfigAndInput (
540
+ listObjectClientConfig ,
541
+ {
542
+ Bucket : bucket ,
543
+ MaxKeys : 1000 ,
544
+ Prefix : resolvePath ( path ) ,
545
+ } ,
546
+ ) ;
547
+ } ,
548
+ ) ;
549
+
509
550
it . each ( pathTestCases ) (
510
551
'should list all objects having three pages with custom path: $path' ,
511
552
async ( { path : inputPath } ) => {
0 commit comments