Skip to content

Commit 2510789

Browse files
authored
chore(deps-dev): bump jest to v27 (#3130)
1 parent b0c7cf1 commit 2510789

File tree

23 files changed

+957
-620
lines changed

23 files changed

+957
-620
lines changed

lib/lib-storage/src/Upload.spec.ts

Lines changed: 20 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe(Upload.name, () => {
6262
Body: "this-is-a-sample-payload",
6363
};
6464

65-
it("correctly exposes the event emitter API", (done) => {
65+
it("correctly exposes the event emitter API", () => {
6666
const upload = new Upload({
6767
params,
6868
client: new S3({}),
@@ -72,11 +72,9 @@ describe(Upload.name, () => {
7272
expect(upload.eventNames).toBeDefined();
7373
expect(upload.off).toBeDefined();
7474
expect(upload.on).toBeDefined();
75-
76-
done();
7775
});
7876

79-
it("should upload using PUT when empty buffer", async (done) => {
77+
it("should upload using PUT when empty buffer", async () => {
8078
const buffer = Buffer.from("");
8179
const actionParams = { ...params, Body: buffer };
8280
const upload = new Upload({
@@ -101,11 +99,9 @@ describe(Upload.name, () => {
10199
expect(completeMultipartMock).toHaveBeenCalledTimes(0);
102100
// no tags were passed.
103101
expect(putObjectTaggingMock).toHaveBeenCalledTimes(0);
104-
105-
done();
106102
});
107103

108-
it("should upload using PUT when empty stream", async (done) => {
104+
it("should upload using PUT when empty stream", async () => {
109105
const stream = new Readable({});
110106
stream.push(null);
111107
const actionParams = { ...params, Body: stream };
@@ -131,11 +127,9 @@ describe(Upload.name, () => {
131127
expect(completeMultipartMock).toHaveBeenCalledTimes(0);
132128
// no tags were passed.
133129
expect(putObjectTaggingMock).toHaveBeenCalledTimes(0);
134-
135-
done();
136130
});
137131

138-
it("should upload using PUT when parts are smaller than one part", async (done) => {
132+
it("should upload using PUT when parts are smaller than one part", async () => {
139133
const upload = new Upload({
140134
params,
141135
client: new S3({}),
@@ -158,11 +152,9 @@ describe(Upload.name, () => {
158152
expect(completeMultipartMock).toHaveBeenCalledTimes(0);
159153
// no tags were passed.
160154
expect(putObjectTaggingMock).toHaveBeenCalledTimes(0);
161-
162-
done();
163155
});
164156

165-
it("should upload using PUT when parts are smaller than one part stream", async (done) => {
157+
it("should upload using PUT when parts are smaller than one part stream", async () => {
166158
const streamBody = Readable.from(
167159
(function* () {
168160
yield params.Body;
@@ -190,11 +182,9 @@ describe(Upload.name, () => {
190182
expect(completeMultipartMock).toHaveBeenCalledTimes(0);
191183
// no tags were passed.
192184
expect(putObjectTaggingMock).toHaveBeenCalledTimes(0);
193-
194-
done();
195185
});
196186

197-
it("should upload using multi-part when parts are larger than part size", async (done) => {
187+
it("should upload using multi-part when parts are larger than part size", async () => {
198188
// create a string that's larger than 5MB.
199189
const partSize = 1024 * 1024 * 5;
200190
const largeBuffer = Buffer.from("#".repeat(partSize + 10));
@@ -256,10 +246,9 @@ describe(Upload.name, () => {
256246
expect(putObjectTaggingMock).toHaveBeenCalledTimes(0);
257247
// put was not called
258248
expect(putObjectMock).toHaveBeenCalledTimes(0);
259-
done();
260249
});
261250

262-
it("should upload using multi-part when parts are larger than part size stream", async (done) => {
251+
it("should upload using multi-part when parts are larger than part size stream", async () => {
263252
// create a string that's larger than 5MB.
264253
const largeBuffer = Buffer.from("#".repeat(DEFAULT_PART_SIZE + 10));
265254
const firstBuffer = largeBuffer.subarray(0, DEFAULT_PART_SIZE);
@@ -325,10 +314,9 @@ describe(Upload.name, () => {
325314
expect(putObjectTaggingMock).toHaveBeenCalledTimes(0);
326315
// put was not called
327316
expect(putObjectMock).toHaveBeenCalledTimes(0);
328-
done();
329317
});
330318

331-
it("should add tags to the object if tags have been added PUT", async (done) => {
319+
it("should add tags to the object if tags have been added PUT", async () => {
332320
const tags = [
333321
{
334322
Key: "k1",
@@ -358,11 +346,9 @@ describe(Upload.name, () => {
358346
TagSet: tags,
359347
},
360348
});
361-
362-
done();
363349
});
364350

365-
it("should add tags to the object if tags have been added multi-part", async (done) => {
351+
it("should add tags to the object if tags have been added multi-part", async () => {
366352
const largeBuffer = Buffer.from("#".repeat(DEFAULT_PART_SIZE + 10));
367353
const actionParams = { ...params, Body: largeBuffer };
368354
const tags = [
@@ -394,44 +380,35 @@ describe(Upload.name, () => {
394380
TagSet: tags,
395381
},
396382
});
397-
398-
done();
399383
});
400384

401-
it("should validate partsize", async (done) => {
385+
it("should validate partsize", () => {
402386
try {
403-
const upload = new Upload({
387+
new Upload({
404388
params,
405389
partSize: 6,
406390
client: new S3({}),
407391
});
408-
409-
//should not get here.
410-
expect(1).toEqual(0);
392+
fail();
411393
} catch (error) {
412394
expect(error).toBeDefined();
413-
done();
414395
}
415396
});
416397

417-
it("should validate queue size", (done) => {
398+
it("should validate queue size", () => {
418399
try {
419-
const upload = new Upload({
400+
new Upload({
420401
params,
421402
queueSize: -1,
422403
client: new S3({}),
423404
});
424-
425-
//should not get here.
426-
expect(1).toEqual(0);
405+
fail();
427406
} catch (error) {
428407
expect(error).toBeDefined();
429-
done();
430408
}
431-
done();
432409
});
433410

434-
it("should provide progress updates", async (done) => {
411+
it("should provide progress updates", async () => {
435412
const upload = new Upload({
436413
params,
437414
client: new S3({}),
@@ -445,12 +422,11 @@ describe(Upload.name, () => {
445422
part: 1,
446423
total: 24,
447424
});
448-
done();
449425
});
450426
await upload.done();
451427
});
452428

453-
it("should provide progress updates multi-part buffer", async (done) => {
429+
it("should provide progress updates multi-part buffer", async () => {
454430
const partSize = 1024 * 1024 * 5;
455431
const largeBuffer = Buffer.from("#".repeat(partSize + 10));
456432
const firstBuffer = largeBuffer.subarray(0, partSize);
@@ -480,10 +456,9 @@ describe(Upload.name, () => {
480456
total: largeBuffer.byteLength,
481457
});
482458
expect(received.length).toBe(2);
483-
done();
484459
});
485460

486-
it("should provide progress updates multi-part stream", async (done) => {
461+
it("should provide progress updates multi-part stream", async () => {
487462
const partSize = 1024 * 1024 * 5;
488463
const largeBuffer = Buffer.from("#".repeat(partSize + 10));
489464
const streamBody = Readable.from(
@@ -517,10 +492,9 @@ describe(Upload.name, () => {
517492
total: undefined,
518493
});
519494
expect(received.length).toBe(2);
520-
done();
521495
});
522496

523-
it("should provide progress updates empty buffer", async (done) => {
497+
it("should provide progress updates empty buffer", async () => {
524498
const buffer = Buffer.from("");
525499
const actionParams = { ...params, Body: buffer };
526500
const upload = new Upload({
@@ -541,10 +515,9 @@ describe(Upload.name, () => {
541515
total: 0,
542516
});
543517
expect(received.length).toBe(1);
544-
done();
545518
});
546519

547-
it("should provide progress updates empty stream", async (done) => {
520+
it("should provide progress updates empty stream", async () => {
548521
const stream = Readable.from((function* () {})());
549522
const actionParams = { ...params, Body: stream };
550523
const upload = new Upload({
@@ -565,6 +538,5 @@ describe(Upload.name, () => {
565538
total: 0,
566539
});
567540
expect(received.length).toBe(1);
568-
done();
569541
});
570542
});

lib/lib-storage/src/chunks/getChunkBuffer.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ describe.only(getChunkBuffer.name, () => {
55
const getBuffer = (size: number) => Buffer.from("#".repeat(size));
66

77
describe("Buffer chunking", () => {
8-
it("should come back with small sub buffers", async (done) => {
8+
it("should come back with small sub buffers", async () => {
99
const chunklength = 100;
1010
const totalLength = 1000;
1111
const buffer = getBuffer(totalLength);
@@ -25,10 +25,9 @@ describe.only(getChunkBuffer.name, () => {
2525
}
2626

2727
expect(chunkNum).toEqual(expectedNumberOfChunks);
28-
done();
2928
});
3029

31-
it("should come back with the last chunk the remainder size", async (done) => {
30+
it("should come back with the last chunk the remainder size", async () => {
3231
const chunklength = 1000;
3332
const totalLength = 2200;
3433
const buffer = getBuffer(totalLength);
@@ -46,10 +45,9 @@ describe.only(getChunkBuffer.name, () => {
4645
expect(chunks[1].lastPart).toBe(undefined);
4746
expect(byteLength(chunks[2].data)).toBe(totalLength % chunklength);
4847
expect(chunks[2].lastPart).toBe(true);
49-
done();
5048
});
5149

52-
it("should come back with one chunk if it is a small buffer", async (done) => {
50+
it("should come back with one chunk if it is a small buffer", async () => {
5351
const chunklength = 1000;
5452
const totalLength = 200;
5553
const buffer = getBuffer(totalLength);
@@ -63,7 +61,6 @@ describe.only(getChunkBuffer.name, () => {
6361
expect(chunks.length).toEqual(1);
6462
expect(byteLength(chunks[0].data)).toBe(totalLength % chunklength);
6563
expect(chunks[0].lastPart).toBe(true);
66-
done();
6764
});
6865
});
6966
});

lib/lib-storage/src/chunks/getDataReadable.spec.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe(chunkFromReadable.name, () => {
3232
return chunks;
3333
};
3434

35-
it("should return chunks of a specific size", async (done) => {
35+
it("should return chunks of a specific size", async () => {
3636
const chunks = await getChunks(58, 1, 20);
3737

3838
expect(chunks.length).toBe(3);
@@ -47,10 +47,9 @@ describe(chunkFromReadable.name, () => {
4747
expect(byteLength(chunks[2].data)).toEqual(18);
4848
expect(chunks[2].partNumber).toEqual(3);
4949
expect(chunks[2].lastPart).toBe(true);
50-
done();
5150
});
5251

53-
it("should properly chunk a file", async (done) => {
52+
it("should properly chunk a file", async () => {
5453
const fileStream = fs.createReadStream(__dirname + "/sample.file");
5554
const chunks: DataPart[] = [];
5655
const chunker = chunkFromReadable<Readable>(fileStream, _6MB, getDataReadable);
@@ -62,10 +61,9 @@ describe(chunkFromReadable.name, () => {
6261
expect(byteLength(chunks[0].data)).toEqual(byteLength(fileStream));
6362
expect(chunks[0].partNumber).toEqual(1);
6463
expect(chunks[0].lastPart).toBe(true);
65-
done();
6664
});
6765

68-
it("should properly chunk a large stream of unknown size", async (done) => {
66+
it("should properly chunk a large stream of unknown size", async () => {
6967
//should go into 11 chunks. Each with ~6mb and the last with 3mb
7068
const chunks = await getChunks(_6MB / 2, 21, _6MB);
7169

@@ -76,6 +74,5 @@ describe(chunkFromReadable.name, () => {
7674
}
7775
expect(byteLength(chunks[10].data)).toEqual(_6MB / 2);
7876
expect(chunks[10].lastPart).toBe(true);
79-
done();
8077
});
8178
});

lib/lib-storage/src/chunks/getDataReadableStream.spec.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,16 @@ describe("chunkFromReadable.name", () => {
3535
return chunks;
3636
};
3737

38-
it("should a single chunk if the stream is smaller than partsize", async (done) => {
38+
it("should a single chunk if the stream is smaller than partsize", async () => {
3939
const chunks = await getChunks(34, 2, 100);
4040

4141
expect(chunks.length).toBe(1);
4242
expect(byteLength(chunks[0].data)).toEqual(68);
4343
expect(chunks[0].partNumber).toEqual(1);
4444
expect(chunks[0].lastPart).toBe(true);
45-
46-
done();
4745
});
4846

49-
it("should return chunks of a specific size", async (done) => {
47+
it("should return chunks of a specific size", async () => {
5048
const chunks = await getChunks(58, 1, 20);
5149

5250
expect(chunks.length).toBe(3);
@@ -61,10 +59,9 @@ describe("chunkFromReadable.name", () => {
6159
expect(byteLength(chunks[2].data)).toEqual(18);
6260
expect(chunks[2].partNumber).toEqual(3);
6361
expect(chunks[2].lastPart).toBe(true);
64-
done();
6562
});
6663

67-
it("should properly chunk a large stream of unknown size", async (done) => {
64+
it("should properly chunk a large stream of unknown size", async () => {
6865
const chunks = await getChunks(_6MB / 2, 21, _6MB);
6966

7067
expect(chunks.length).toEqual(11);
@@ -74,6 +71,5 @@ describe("chunkFromReadable.name", () => {
7471
}
7572
expect(byteLength(chunks[10].data)).toEqual(_6MB / 2);
7673
expect(chunks[10].lastPart).toBe(true);
77-
done();
7874
});
7975
});

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"@mixer/parallel-prettier": "^2.0.1",
6060
"@types/chai-as-promised": "^7.1.2",
6161
"@types/fs-extra": "^8.0.1",
62-
"@types/jest": "^26.0.4",
62+
"@types/jest": "27.4.0",
6363
"@typescript-eslint/eslint-plugin": "4.30.0",
6464
"@typescript-eslint/parser": "4.30.0",
6565
"async": "3.2.1",
@@ -79,7 +79,7 @@
7979
"generate-changelog": "^1.7.1",
8080
"husky": "^4.2.3",
8181
"jasmine-core": "^3.5.0",
82-
"jest": "^26.1.0",
82+
"jest": "27.4.5",
8383
"jmespath": "^0.15.0",
8484
"json5": "^2.2.0",
8585
"karma": "^5.1.0",
@@ -99,7 +99,7 @@
9999
"prettier": "2.5.1",
100100
"puppeteer": "^5.1.0",
101101
"strip-comments": "2.0.1",
102-
"ts-jest": "^26.4.1",
102+
"ts-jest": "27.1.2",
103103
"ts-loader": "^7.0.5",
104104
"ts-mocha": "8.0.0",
105105
"ts-node": "^10.4.0",

packages/body-checksum-browser/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ const base = require("../../jest.config.base.js");
22

33
module.exports = {
44
...base,
5+
testEnvironment: "jsdom",
56
};

packages/chunked-blob-reader-native/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ const base = require("../../jest.config.base.js");
22

33
module.exports = {
44
...base,
5+
testEnvironment: "jsdom",
56
};

packages/chunked-blob-reader/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ const base = require("../../jest.config.base.js");
22

33
module.exports = {
44
...base,
5+
testEnvironment: "jsdom",
56
};

0 commit comments

Comments
 (0)