aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/buffer.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/bun.js/buffer.test.js')
-rw-r--r--test/bun.js/buffer.test.js24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/bun.js/buffer.test.js b/test/bun.js/buffer.test.js
index d263a80eb..64c6cc41f 100644
--- a/test/bun.js/buffer.test.js
+++ b/test/bun.js/buffer.test.js
@@ -1,6 +1,8 @@
import { describe, it, expect, beforeEach, afterEach } from "bun:test";
import { gc } from "./gc";
+const BufferModule = await import("buffer");
+
beforeEach(() => gc());
afterEach(() => gc());
@@ -560,7 +562,7 @@ it("Buffer.swap16", () => {
const examples = [
["", ""],
["a1", "1a"],
- ["a1b2", "1a2b"]
+ ["a1b2", "1a2b"],
];
for (let i = 0; i < examples.length; i++) {
@@ -586,7 +588,7 @@ it("Buffer.swap32", () => {
const examples = [
["", ""],
["a1b2", "2b1a"],
- ["a1b2c3d4", "2b1a4d3c"]
+ ["a1b2c3d4", "2b1a4d3c"],
];
for (let i = 0; i < examples.length; i++) {
@@ -698,3 +700,21 @@ it("Buffer can be mocked", () => {
buf.writeBigUInt64LE(0);
}).not.toThrow();
});
+
+it("constants", () => {
+ expect(BufferModule.constants.MAX_LENGTH).toBe(4294967296);
+ expect(BufferModule.constants.MAX_STRING_LENGTH).toBe(536870888);
+ expect(BufferModule.default.constants.MAX_LENGTH).toBe(4294967296);
+ expect(BufferModule.default.constants.MAX_STRING_LENGTH).toBe(536870888);
+});
+
+it("File", () => {
+ expect(BufferModule.File).toBe(Blob);
+});
+
+it("transcode", () => {
+ expect(typeof BufferModule.transcode).toBe("undefined");
+
+ // This is a masqueradesAsUndefined function
+ expect(() => BufferModule.transcode()).toThrow("Not implemented");
+});