@@ -116,33 +116,33 @@ test("R2Bucket: resumeMultipartUpload", async (t) => {
116
116
const { r2 } = t . context ;
117
117
118
118
// Check creates upload object with correct key and uploadId
119
- let upload = await r2 . resumeMultipartUpload ( "key" , "upload" ) ;
119
+ let upload = r2 . resumeMultipartUpload ( "key" , "upload" ) ;
120
120
t . is ( upload . key , "key" ) ;
121
121
t . is ( upload . uploadId , "upload" ) ;
122
122
123
123
// Check validates key and uploadId provided, but not key length
124
124
// @ts -expect-error intentionally testing incorrect types
125
- await t . throwsAsync ( r2 . resumeMultipartUpload ( ) , {
125
+ t . throws ( ( ) => r2 . resumeMultipartUpload ( ) , {
126
126
instanceOf : TypeError ,
127
127
message :
128
128
"Failed to execute 'resumeMultipartUpload' on 'R2Bucket': parameter 1 is not of type 'string'." ,
129
129
} ) ;
130
130
// @ts -expect-error intentionally testing incorrect types
131
- await t . throwsAsync ( r2 . resumeMultipartUpload ( "key" ) , {
131
+ t . throws ( ( ) => r2 . resumeMultipartUpload ( "key" ) , {
132
132
instanceOf : TypeError ,
133
133
message :
134
134
"Failed to execute 'resumeMultipartUpload' on 'R2Bucket': parameter 2 is not of type 'string'." ,
135
135
} ) ;
136
- upload = await r2 . resumeMultipartUpload ( "x" . repeat ( 1025 ) , "upload" ) ;
136
+ upload = r2 . resumeMultipartUpload ( "x" . repeat ( 1025 ) , "upload" ) ;
137
137
t . is ( upload . key , "x" . repeat ( 1025 ) ) ;
138
138
139
139
// Check coerces key and uploadId to string
140
140
// @ts -expect-error intentionally testing incorrect types
141
- upload = await r2 . resumeMultipartUpload ( 1 , 2 ) ;
141
+ upload = r2 . resumeMultipartUpload ( 1 , 2 ) ;
142
142
t . is ( upload . key , "1" ) ;
143
143
t . is ( upload . uploadId , "2" ) ;
144
144
// @ts -expect-error intentionally testing incorrect types
145
- upload = await r2 . resumeMultipartUpload ( undefined , undefined ) ;
145
+ upload = r2 . resumeMultipartUpload ( undefined , undefined ) ;
146
146
t . is ( upload . key , "undefined" ) ;
147
147
t . is ( upload . uploadId , "undefined" ) ;
148
148
} ) ;
@@ -220,12 +220,12 @@ test("R2MultipartUpload: uploadPart", async (t) => {
220
220
221
221
// Check validates key and uploadId
222
222
let expectations = doesNotExistExpectations ( "uploadPart" ) ;
223
- let nonExistentUpload = await r2 . resumeMultipartUpload ( "key" , "bad" ) ;
223
+ let nonExistentUpload = r2 . resumeMultipartUpload ( "key" , "bad" ) ;
224
224
await t . throwsAsync ( nonExistentUpload . uploadPart ( 1 , "value" ) , expectations ) ;
225
- nonExistentUpload = await r2 . resumeMultipartUpload ( "badkey" , upload . uploadId ) ;
225
+ nonExistentUpload = r2 . resumeMultipartUpload ( "badkey" , upload . uploadId ) ;
226
226
await t . throwsAsync ( nonExistentUpload . uploadPart ( 1 , "value" ) , expectations ) ;
227
227
expectations = objectNameNotValidExpectations ( "uploadPart" ) ;
228
- nonExistentUpload = await r2 . resumeMultipartUpload ( "x" . repeat ( 1025 ) , "bad" ) ;
228
+ nonExistentUpload = r2 . resumeMultipartUpload ( "x" . repeat ( 1025 ) , "bad" ) ;
229
229
await t . throwsAsync ( nonExistentUpload . uploadPart ( 1 , "value" ) , expectations ) ;
230
230
231
231
// Check validates part number (before key and uploadId)
@@ -331,12 +331,12 @@ test("R2MultipartUpload: abort", async (t) => {
331
331
const upload3 = await r2 . createMultipartUpload ( "key" ) ;
332
332
// Note this is internalErrorExpectations, not doesNotExistExpectations
333
333
expectations = internalErrorExpectations ( "abortMultipartUpload" ) ;
334
- let nonExistentUpload = await r2 . resumeMultipartUpload ( "key" , "bad" ) ;
334
+ let nonExistentUpload = r2 . resumeMultipartUpload ( "key" , "bad" ) ;
335
335
await t . throwsAsync ( nonExistentUpload . abort ( ) , expectations ) ;
336
- nonExistentUpload = await r2 . resumeMultipartUpload ( "bad" , upload3 . uploadId ) ;
336
+ nonExistentUpload = r2 . resumeMultipartUpload ( "bad" , upload3 . uploadId ) ;
337
337
await t . throwsAsync ( nonExistentUpload . abort ( ) , expectations ) ;
338
338
expectations = objectNameNotValidExpectations ( "abortMultipartUpload" ) ;
339
- nonExistentUpload = await r2 . resumeMultipartUpload ( "x" . repeat ( 1025 ) , "bad" ) ;
339
+ nonExistentUpload = r2 . resumeMultipartUpload ( "x" . repeat ( 1025 ) , "bad" ) ;
340
340
await t . throwsAsync ( nonExistentUpload . abort ( ) , expectations ) ;
341
341
} ) ;
342
342
test ( "R2MultipartUpload: complete" , async ( t ) => {
@@ -511,15 +511,12 @@ test("R2MultipartUpload: complete", async (t) => {
511
511
const upload11 = await r2 . createMultipartUpload ( "key" ) ;
512
512
// Note this is internalErrorExpectations, not doesNotExistExpectations
513
513
let expectations = internalErrorExpectations ( "completeMultipartUpload" ) ;
514
- let nonExistentUpload = await r2 . resumeMultipartUpload ( "key" , "bad" ) ;
514
+ let nonExistentUpload = r2 . resumeMultipartUpload ( "key" , "bad" ) ;
515
515
await t . throwsAsync ( nonExistentUpload . complete ( [ ] ) , expectations ) ;
516
- nonExistentUpload = await r2 . resumeMultipartUpload (
517
- "badkey" ,
518
- upload11 . uploadId
519
- ) ;
516
+ nonExistentUpload = r2 . resumeMultipartUpload ( "badkey" , upload11 . uploadId ) ;
520
517
await t . throwsAsync ( nonExistentUpload . complete ( [ ] ) , expectations ) ;
521
518
expectations = objectNameNotValidExpectations ( "completeMultipartUpload" ) ;
522
- nonExistentUpload = await r2 . resumeMultipartUpload ( "x" . repeat ( 1025 ) , "bad" ) ;
519
+ nonExistentUpload = r2 . resumeMultipartUpload ( "x" . repeat ( 1025 ) , "bad" ) ;
523
520
await t . throwsAsync ( nonExistentUpload . complete ( [ ] ) , expectations ) ;
524
521
525
522
// Check validates uploaded parts
@@ -872,7 +869,7 @@ test("R2Bucket/R2MultipartUpload: operations throw outside request handler", asy
872
869
await t . throwsAsync ( r2 . createMultipartUpload ( "key" ) , expectations ) ;
873
870
// (resumeMultipartUpload() doesn't make any "network" calls, so can be called
874
871
// outside a request context)
875
- await r2 . resumeMultipartUpload ( "key" , "upload" ) ;
872
+ r2 . resumeMultipartUpload ( "key" , "upload" ) ;
876
873
877
874
t . is ( ctx . internalSubrequests , 0 ) ;
878
875
const upload = await ctx . runWith ( ( ) => r2 . createMultipartUpload ( "key" ) ) ;
0 commit comments