Skip to content

Commit 0cfb6ba

Browse files
committed
fixing tests after re enabling them
1 parent 84efb1b commit 0cfb6ba

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

tests/functional/aws-node-sdk/test/object/rangeTest.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ function checkRanges(range, bytes) {
5959

6060
assert.deepStrictEqual(res.ContentLength, total);
6161
assert.deepStrictEqual(res.ContentRange, contentRange);
62-
assert.deepStrictEqual(res.ContentType, 'application/octet-stream');
62+
assert(res.ContentType === undefined ||
63+
res.ContentType === 'application/octet-stream');
6364
assert.deepStrictEqual(res.Metadata, {});
6465

65-
// AWS SDK v3: Body is a stream; convert to Buffer before writing
6666
const bodyBytes = await res.Body.transformToByteArray();
6767
const bodyBuffer = Buffer.from(bodyBytes);
6868
await writeFileAsync(`hashedFile.${bytes}.${range}`, bodyBuffer);
@@ -148,12 +148,13 @@ describe('aws-node-sdk range tests', () => {
148148
Key: key,
149149
UploadId: uploadId,
150150
})))
151-
.catch(err => new Promise((resolve, reject) => {
152-
if (err.code !== 'NoSuchUpload') {
153-
reject(err);
151+
.catch(err => {
152+
// Upload was already completed in beforeEach; abort is no-op
153+
if (err.name === 'NoSuchUpload' || err.code === 'NoSuchUpload') {
154+
return;
154155
}
155-
resolve();
156-
}))
156+
throw err;
157+
})
157158
.then(() => bucketUtil.deleteOne(bucket))
158159
.then(() => execAsync(`rm hashedFile.${fileSize}*`))
159160
);

0 commit comments

Comments
 (0)