diff options
author | 2022-04-26 01:12:28 -0700 | |
---|---|---|
committer | 2022-04-26 01:12:28 -0700 | |
commit | 77fbfb3fbb4259150d6b59fe182ccd64e1fb9f0d (patch) | |
tree | df930fa1bb1e7eb408762e8138aec580fed4e4e8 /integration/bunjs-only-snippets/buffer.test.js | |
parent | 6590d1f8bf09838e4530848af74990c5ba89eb81 (diff) | |
download | bun-77fbfb3fbb4259150d6b59fe182ccd64e1fb9f0d.tar.gz bun-77fbfb3fbb4259150d6b59fe182ccd64e1fb9f0d.tar.zst bun-77fbfb3fbb4259150d6b59fe182ccd64e1fb9f0d.zip |
Most of Buffer.toString
Diffstat (limited to 'integration/bunjs-only-snippets/buffer.test.js')
-rw-r--r-- | integration/bunjs-only-snippets/buffer.test.js | 12 |
1 files changed, 12 insertions, 0 deletions
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); +}); |