From f7f1b604443c030afe29d1059b90f72c69afe081 Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Wed, 9 Nov 2022 15:40:40 -0800 Subject: Add bun-types, add typechecking, add `child_process` types (#1475) * Add bun-types to packages * Improve typing * Fix types in tests * Fix dts tests * Run formatter * Fix all type errors * Add strict mode, fix type errors * Add ffi changes * Move workflows to root * Add workflows * Remove labeler * Add child_process types * Fix synthetic defaults issue * Remove docs * Move scripts * Run prettier * Include examples in typechecking * captureStackTrace types * moved captureStackTrace types to globals * Address reviews Co-authored-by: Colin McDonnell Co-authored-by: Dylan Conway --- test/bun.js/buffer.test.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'test/bun.js/buffer.test.js') diff --git a/test/bun.js/buffer.test.js b/test/bun.js/buffer.test.js index 4433cf64f..5a367f725 100644 --- a/test/bun.js/buffer.test.js +++ b/test/bun.js/buffer.test.js @@ -9,7 +9,7 @@ it("Buffer.toJSON()", () => { JSON.stringify({ type: "Buffer", data: [104, 101, 108, 108, 111], - }) + }), ); }); @@ -26,7 +26,7 @@ it("buffer", () => { expect(buf.toString("utf8", 0, "hello world ".length)).toBe("hello world "); gc(); expect(buf.toString("base64url", 0, "hello world ".length)).toBe( - btoa("hello world ") + btoa("hello world "), ); gc(); expect(buf instanceof Uint8Array).toBe(true); @@ -65,7 +65,7 @@ it("Buffer", () => { it("Buffer.byteLength", () => { expect(Buffer.byteLength("πŸ˜€πŸ˜ƒπŸ˜„πŸ˜πŸ˜†πŸ˜…πŸ˜‚πŸ€£β˜ΊοΈπŸ˜ŠπŸ˜ŠπŸ˜‡")).toBe( - new TextEncoder().encode("πŸ˜€πŸ˜ƒπŸ˜„πŸ˜πŸ˜†πŸ˜…πŸ˜‚πŸ€£β˜ΊοΈπŸ˜ŠπŸ˜ŠπŸ˜‡").byteLength + new TextEncoder().encode("πŸ˜€πŸ˜ƒπŸ˜„πŸ˜πŸ˜†πŸ˜…πŸ˜‚πŸ€£β˜ΊοΈπŸ˜ŠπŸ˜ŠπŸ˜‡").byteLength, ); }); @@ -120,7 +120,7 @@ it("Buffer.toBuffer works", () => { expect(buf.toString("utf8", 0, "hello world ".length)).toBe("hello world "); gc(); expect(buf.toString("base64url", 0, "hello world ".length)).toBe( - btoa("hello world ") + btoa("hello world "), ); gc(); @@ -149,10 +149,10 @@ it("writeInt", () => { it("Buffer.from", () => { expect(Buffer.from("hello world").toString("utf8")).toBe("hello world"); expect(Buffer.from("hello world", "ascii").toString("utf8")).toBe( - "hello world" + "hello world", ); expect(Buffer.from("hello world", "latin1").toString("utf8")).toBe( - "hello world" + "hello world", ); gc(); expect(Buffer.from([254]).join(",")).toBe("254"); @@ -166,15 +166,15 @@ it("Buffer.from", () => { expect(Buffer.from(123).join(",")).toBe(Uint8Array.from(123).join(",")); expect(Buffer.from({ length: 124 }).join(",")).toBe( - Uint8Array.from({ length: 124 }).join(",") + Uint8Array.from({ length: 124 }).join(","), ); expect(Buffer.from(new ArrayBuffer(1024), 0, 512).join(",")).toBe( - new Uint8Array(512).join(",") + new Uint8Array(512).join(","), ); expect(Buffer.from(new Buffer(new ArrayBuffer(1024), 0, 512)).join(",")).toBe( - new Uint8Array(512).join(",") + new Uint8Array(512).join(","), ); gc(); }); @@ -254,7 +254,7 @@ it("Buffer.compare", () => { [buf.slice(i), Buffer.from(s.slice(i))], [buf.slice(0, i), Buffer.from(s.slice(0, i))], [buf.slice(-i), Buffer.from(s.slice(-i))], - [buf.slice(0, -i), Buffer.from(s.slice(0, -i))] + [buf.slice(0, -i), Buffer.from(s.slice(0, -i))], ); } @@ -375,14 +375,14 @@ it("Buffer.concat", () => { array3.fill(300); gc(); expect(Buffer.concat([array1, array2, array3]).join("")).toBe( - array1.join("") + array2.join("") + array3.join("") + array1.join("") + array2.join("") + array3.join(""), ); expect(Buffer.concat([array1, array2, array3], 222).length).toBe(222); expect( - Buffer.concat([array1, array2, array3], 222).subarray(0, 128).join("") + Buffer.concat([array1, array2, array3], 222).subarray(0, 128).join(""), ).toBe("100".repeat(128)); expect( - Buffer.concat([array1, array2, array3], 222).subarray(129, 222).join("") + Buffer.concat([array1, array2, array3], 222).subarray(129, 222).join(""), ).toBe("200".repeat(222 - 129)); }); -- cgit v1.2.3