@@ -619,6 +619,42 @@ describe('getMultipartUploadHandlers with key', () => {
619
619
expect ( mockListParts ) . not . toHaveBeenCalled ( ) ;
620
620
} ) ;
621
621
622
+ it ( 'should omit unserializable option properties when calculating the hash key' , async ( ) => {
623
+ mockMultipartUploadSuccess ( ) ;
624
+ const serializableOptions = {
625
+ useAccelerateEndpoint : true ,
626
+ bucket : { bucketName : 'bucket' , region : 'us-west-2' } ,
627
+ expectedBucketOwner : '123' ,
628
+ contentDisposition : 'attachment' ,
629
+ contentEncoding : 'deflate' ,
630
+ contentType : 'text/html' ,
631
+ customEndpoint : 'abc' ,
632
+ metadata : { } ,
633
+ preventOverwrite : true ,
634
+ checksumAlgorithm : 'crc-32' as const ,
635
+ } ;
636
+ const size = 8 * MB ;
637
+ const { multipartUploadJob } = getMultipartUploadHandlers (
638
+ {
639
+ key : defaultKey ,
640
+ data : new ArrayBuffer ( size ) ,
641
+ options : {
642
+ ...serializableOptions ,
643
+ // The following options will be omitted
644
+ locationCredentialsProvider : jest . fn ( ) ,
645
+ onProgress : jest . fn ( ) ,
646
+ resumableUploadsCache : mockDefaultStorage ,
647
+ } ,
648
+ } ,
649
+ size ,
650
+ ) ;
651
+ await multipartUploadJob ( ) ;
652
+ expect ( mockCalculateContentCRC32 ) . toHaveBeenNthCalledWith (
653
+ 1 ,
654
+ JSON . stringify ( serializableOptions ) ,
655
+ ) ;
656
+ } ) ;
657
+
622
658
it ( 'should send createMultipartUpload request if the upload task is not cached' , async ( ) => {
623
659
mockMultipartUploadSuccess ( ) ;
624
660
const size = 8 * MB ;
@@ -1451,6 +1487,42 @@ describe('getMultipartUploadHandlers with path', () => {
1451
1487
expect ( mockListParts ) . not . toHaveBeenCalled ( ) ;
1452
1488
} ) ;
1453
1489
1490
+ it ( 'should omit unserializable option properties when calculating the hash key' , async ( ) => {
1491
+ mockMultipartUploadSuccess ( ) ;
1492
+ const serializableOptions = {
1493
+ useAccelerateEndpoint : true ,
1494
+ bucket : { bucketName : 'bucket' , region : 'us-west-2' } ,
1495
+ expectedBucketOwner : '123' ,
1496
+ contentDisposition : 'attachment' ,
1497
+ contentEncoding : 'deflate' ,
1498
+ contentType : 'text/html' ,
1499
+ customEndpoint : 'abc' ,
1500
+ metadata : { } ,
1501
+ preventOverwrite : true ,
1502
+ checksumAlgorithm : 'crc-32' as const ,
1503
+ } ;
1504
+ const size = 8 * MB ;
1505
+ const { multipartUploadJob } = getMultipartUploadHandlers (
1506
+ {
1507
+ path : testPath ,
1508
+ data : new ArrayBuffer ( size ) ,
1509
+ options : {
1510
+ ...serializableOptions ,
1511
+ // The following options will be omitted
1512
+ locationCredentialsProvider : jest . fn ( ) ,
1513
+ onProgress : jest . fn ( ) ,
1514
+ resumableUploadsCache : mockDefaultStorage ,
1515
+ } ,
1516
+ } ,
1517
+ size ,
1518
+ ) ;
1519
+ await multipartUploadJob ( ) ;
1520
+ expect ( mockCalculateContentCRC32 ) . toHaveBeenNthCalledWith (
1521
+ 1 ,
1522
+ JSON . stringify ( serializableOptions ) ,
1523
+ ) ;
1524
+ } ) ;
1525
+
1454
1526
it ( 'should send createMultipartUpload request if the upload task is cached but outdated' , async ( ) => {
1455
1527
mockDefaultStorage . getItem . mockResolvedValue (
1456
1528
JSON . stringify ( {
0 commit comments