diff options
author | 2023-01-04 03:30:15 -0800 | |
---|---|---|
committer | 2023-01-04 03:30:15 -0800 | |
commit | 4a328609b96609dbeb8dc98e19aa2f52d2e5eaab (patch) | |
tree | 36d16a77ab44f3b324e3508b6a3e9f4daecf9df2 /test/bun.js/node-stream-uint8array.test.ts | |
parent | 021331f154123f9fb39ac47d5c98f5a9e1095ea4 (diff) | |
download | bun-4a328609b96609dbeb8dc98e19aa2f52d2e5eaab.tar.gz bun-4a328609b96609dbeb8dc98e19aa2f52d2e5eaab.tar.zst bun-4a328609b96609dbeb8dc98e19aa2f52d2e5eaab.zip |
10x faster `new Buffer` (#1717)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to '')
-rw-r--r-- | test/bun.js/node-stream-uint8array.test.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/bun.js/node-stream-uint8array.test.ts b/test/bun.js/node-stream-uint8array.test.ts index 4bd1c4bcf..ec2e95d34 100644 --- a/test/bun.js/node-stream-uint8array.test.ts +++ b/test/bun.js/node-stream-uint8array.test.ts @@ -9,7 +9,7 @@ describe("Writable", () => { let called; function logCall(fn, id) { - return function() { + return function () { called[id] = (called[id] || 0) + 1; return fn.apply(this, arguments); }; @@ -36,7 +36,7 @@ describe("Writable", () => { writable.write(ABC); writable.end(DEF); - expect(called).toEqual([ 2 ]); + expect(called).toEqual([2]); }); it("should pass in Uint8Array in object mode", () => { @@ -52,7 +52,7 @@ describe("Writable", () => { }); writable.end(ABC); - expect(called).toEqual([ 1 ]); + expect(called).toEqual([1]); }); it("should handle multiple writes carried out via writev()", () => { @@ -77,14 +77,14 @@ describe("Writable", () => { writable.write(DEF); writable.end(GHI); callback(); - expect(called).toEqual([ 1, 1 ]); + expect(called).toEqual([1, 1]); }); }); describe("Readable", () => { it("should perform simple operations", () => { const readable = new Readable({ - read() {} + read() {}, }); readable.push(DEF); @@ -92,12 +92,12 @@ describe("Readable", () => { const buf = readable.read(); expect(buf instanceof Buffer).toBe(true); - expect([ ...buf ]).toEqual([ ...ABC, ...DEF ]); + expect([...buf]).toEqual([...ABC, ...DEF]); }); it("should work with setEncoding()", () => { const readable = new Readable({ - read() {} + read() {}, }); readable.setEncoding("utf8"); |