33 CreateBucketCommand,
44 CreateMultipartUploadCommand,
55 AbortMultipartUploadCommand,
6+ ListMultipartUploadsCommand,
67 DeleteBucketCommand,
78} = require ( '@aws-sdk/client-s3' ) ;
89
@@ -32,24 +33,27 @@ describe('CreateMultipartUpload checksum headers', () =>
3233 let res ;
3334
3435 before ( async ( ) => {
35- res = await s3 . send ( new CreateMultipartUploadCommand ( {
36- Bucket : bucket ,
37- Key : key ,
38- } ) ) ;
36+ res = await s3 . send ( new CreateMultipartUploadCommand ( { Bucket : bucket , Key : key } ) ) ;
3937 } ) ;
4038
4139 after ( async ( ) => {
4240 await s3 . send ( new AbortMultipartUploadCommand ( {
43- Bucket : bucket ,
44- Key : key ,
45- UploadId : res . UploadId ,
41+ Bucket : bucket , Key : key , UploadId : res . UploadId ,
4642 } ) ) ;
4743 } ) ;
4844
4945 it ( 'should not return ChecksumAlgorithm and ChecksumType' , ( ) => {
5046 assert . strictEqual ( res . ChecksumAlgorithm , undefined ) ;
5147 assert . strictEqual ( res . ChecksumType , undefined ) ;
5248 } ) ;
49+
50+ it ( 'should not include ChecksumAlgorithm or ChecksumType in ListMultipartUploads' , async ( ) => {
51+ const { Uploads } = await s3 . send ( new ListMultipartUploadsCommand ( { Bucket : bucket } ) ) ;
52+ const upload = Uploads . find ( u => u . UploadId === res . UploadId ) ;
53+ assert ( upload , 'upload not found in listing' ) ;
54+ assert . strictEqual ( upload . ChecksumAlgorithm , undefined ) ;
55+ assert . strictEqual ( upload . ChecksumType , undefined ) ;
56+ } ) ;
5357 } ) ;
5458
5559 describe ( 'valid algorithm only' , ( ) => {
@@ -67,25 +71,28 @@ describe('CreateMultipartUpload checksum headers', () =>
6771
6872 before ( async ( ) => {
6973 res = await s3 . send ( new CreateMultipartUploadCommand ( {
70- Bucket : bucket ,
71- Key : key ,
72- ChecksumAlgorithm : algo ,
74+ Bucket : bucket , Key : key , ChecksumAlgorithm : algo ,
7375 } ) ) ;
7476 } ) ;
7577
7678 after ( async ( ) => {
7779 await s3 . send ( new AbortMultipartUploadCommand ( {
78- Bucket : bucket ,
79- Key : key ,
80- UploadId : res . UploadId ,
80+ Bucket : bucket , Key : key , UploadId : res . UploadId ,
8181 } ) ) ;
8282 } ) ;
8383
84- it ( `should return ChecksumAlgorithm ${ algo } and ` +
85- `default ChecksumType to ${ expectedType } ` , ( ) => {
84+ it ( `should return ChecksumAlgorithm ${ algo } and default ChecksumType to ${ expectedType } ` , ( ) => {
8685 assert . strictEqual ( res . ChecksumAlgorithm , algo ) ;
8786 assert . strictEqual ( res . ChecksumType , expectedType ) ;
8887 } ) ;
88+
89+ it ( `should include ${ algo } /${ expectedType } in ListMultipartUploads` , async ( ) => {
90+ const { Uploads } = await s3 . send ( new ListMultipartUploadsCommand ( { Bucket : bucket } ) ) ;
91+ const upload = Uploads . find ( u => u . UploadId === res . UploadId ) ;
92+ assert ( upload , 'upload not found in listing' ) ;
93+ assert . strictEqual ( upload . ChecksumAlgorithm , algo ) ;
94+ assert . strictEqual ( upload . ChecksumType , expectedType ) ;
95+ } ) ;
8996 } ) ;
9097 } ) ;
9198 } ) ;
@@ -107,26 +114,28 @@ describe('CreateMultipartUpload checksum headers', () =>
107114
108115 before ( async ( ) => {
109116 res = await s3 . send ( new CreateMultipartUploadCommand ( {
110- Bucket : bucket ,
111- Key : key ,
112- ChecksumAlgorithm : algo ,
113- ChecksumType : type ,
117+ Bucket : bucket , Key : key , ChecksumAlgorithm : algo , ChecksumType : type ,
114118 } ) ) ;
115119 } ) ;
116120
117121 after ( async ( ) => {
118122 await s3 . send ( new AbortMultipartUploadCommand ( {
119- Bucket : bucket ,
120- Key : key ,
121- UploadId : res . UploadId ,
123+ Bucket : bucket , Key : key , UploadId : res . UploadId ,
122124 } ) ) ;
123125 } ) ;
124126
125- it ( `should return ChecksumAlgorithm ${ algo } and ` +
126- `ChecksumType ${ type } ` , ( ) => {
127+ it ( `should return ChecksumAlgorithm ${ algo } and ChecksumType ${ type } ` , ( ) => {
127128 assert . strictEqual ( res . ChecksumAlgorithm , algo ) ;
128129 assert . strictEqual ( res . ChecksumType , type ) ;
129130 } ) ;
131+
132+ it ( `should include ${ algo } /${ type } in ListMultipartUploads` , async ( ) => {
133+ const { Uploads } = await s3 . send ( new ListMultipartUploadsCommand ( { Bucket : bucket } ) ) ;
134+ const upload = Uploads . find ( u => u . UploadId === res . UploadId ) ;
135+ assert ( upload , 'upload not found in listing' ) ;
136+ assert . strictEqual ( upload . ChecksumAlgorithm , algo ) ;
137+ assert . strictEqual ( upload . ChecksumType , type ) ;
138+ } ) ;
130139 } ) ;
131140 } ) ;
132141 } ) ;
@@ -135,10 +144,7 @@ describe('CreateMultipartUpload checksum headers', () =>
135144 it ( 'should reject FULL_OBJECT with SHA256' , async ( ) => {
136145 try {
137146 await s3 . send ( new CreateMultipartUploadCommand ( {
138- Bucket : bucket ,
139- Key : key ,
140- ChecksumAlgorithm : 'SHA256' ,
141- ChecksumType : 'FULL_OBJECT' ,
147+ Bucket : bucket , Key : key , ChecksumAlgorithm : 'SHA256' , ChecksumType : 'FULL_OBJECT' ,
142148 } ) ) ;
143149 assert . fail ( 'Expected error' ) ;
144150 } catch ( err ) {
@@ -149,10 +155,7 @@ describe('CreateMultipartUpload checksum headers', () =>
149155 it ( 'should reject FULL_OBJECT with SHA1' , async ( ) => {
150156 try {
151157 await s3 . send ( new CreateMultipartUploadCommand ( {
152- Bucket : bucket ,
153- Key : key ,
154- ChecksumAlgorithm : 'SHA1' ,
155- ChecksumType : 'FULL_OBJECT' ,
158+ Bucket : bucket , Key : key , ChecksumAlgorithm : 'SHA1' , ChecksumType : 'FULL_OBJECT' ,
156159 } ) ) ;
157160 assert . fail ( 'Expected error' ) ;
158161 } catch ( err ) {
@@ -163,10 +166,7 @@ describe('CreateMultipartUpload checksum headers', () =>
163166 it ( 'should reject COMPOSITE with CRC64NVME' , async ( ) => {
164167 try {
165168 await s3 . send ( new CreateMultipartUploadCommand ( {
166- Bucket : bucket ,
167- Key : key ,
168- ChecksumAlgorithm : 'CRC64NVME' ,
169- ChecksumType : 'COMPOSITE' ,
169+ Bucket : bucket , Key : key , ChecksumAlgorithm : 'CRC64NVME' , ChecksumType : 'COMPOSITE' ,
170170 } ) ) ;
171171 assert . fail ( 'Expected error' ) ;
172172 } catch ( err ) {
0 commit comments