aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-02-11 18:11:09 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-02-11 18:11:09 -0800
commit675529bd0cc7f7753b1d33cf0f14d945bd850654 (patch)
treeb8285ab53fa2b02f1e3a5110b23445bfa998a966 /test/bun.js
parent5528c0fa47399a28e2caadf540f4b385c6bb3f4f (diff)
downloadbun-675529bd0cc7f7753b1d33cf0f14d945bd850654.tar.gz
bun-675529bd0cc7f7753b1d33cf0f14d945bd850654.tar.zst
bun-675529bd0cc7f7753b1d33cf0f14d945bd850654.zip
Fixes https://github.com/oven-sh/bun/issues/2052
Diffstat (limited to 'test/bun.js')
-rw-r--r--test/bun.js/buffer.test.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/bun.js/buffer.test.js b/test/bun.js/buffer.test.js
index 6c4e9d721..f8704d040 100644
--- a/test/bun.js/buffer.test.js
+++ b/test/bun.js/buffer.test.js
@@ -25,6 +25,16 @@ Object.assign(assert, {
},
});
+// https://github.com/oven-sh/bun/issues/2052
+it("Buffer global is settable", () => {
+ var prevBuffer = globalThis.Buffer;
+ globalThis.Buffer = 42;
+ expect(globalThis.Buffer).toBe(42);
+ globalThis.Buffer = prevBuffer;
+ expect(globalThis.Buffer).toBe(BufferModule.Buffer);
+ expect(globalThis.Buffer).toBe(prevBuffer);
+});
+
it("Buffer.alloc", () => {
// Verify the maximum Uint8Array size. There is no concrete limit by spec. The
// internal limits should be updated if this fails.