From 77fbfb3fbb4259150d6b59fe182ccd64e1fb9f0d Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Tue, 26 Apr 2022 01:12:28 -0700 Subject: Most of Buffer.toString --- integration/bunjs-only-snippets/buffer.test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 integration/bunjs-only-snippets/buffer.test.js (limited to 'integration/bunjs-only-snippets/buffer.test.js') diff --git a/integration/bunjs-only-snippets/buffer.test.js b/integration/bunjs-only-snippets/buffer.test.js new file mode 100644 index 000000000..f8cd3aa5b --- /dev/null +++ b/integration/bunjs-only-snippets/buffer.test.js @@ -0,0 +1,12 @@ +import { describe, it, expect } from "bun:test"; + +it("buffer", () => { + var buf = new Buffer(1024); + expect(buf.write("hello world ")).toBe(12); + expect(buf.toString("utf8", 0, "hello world ".length)).toBe("hello world "); + expect(buf.toString("base64url", 0, "hello world ".length)).toBe( + btoa("hello world ") + ); + expect(buf instanceof Uint8Array).toBe(true); + expect(buf instanceof Buffer).toBe(true); +}); -- cgit v1.2.3