aboutsummaryrefslogtreecommitdiff
path: root/test/js/web/encoding/text-encoder.test.js
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-03-18 00:55:05 -0700
committerGravatar GitHub <noreply@github.com> 2023-03-18 00:55:05 -0700
commita9c41c67e639714fbb4d7764e18be37615280c08 (patch)
tree200e293da7e447f349c9dc6c2cfee593d21a3eff /test/js/web/encoding/text-encoder.test.js
parent1d4cc63154366dbdbdb87c8da43753cdac13d995 (diff)
downloadbun-a9c41c67e639714fbb4d7764e18be37615280c08.tar.gz
bun-a9c41c67e639714fbb4d7764e18be37615280c08.tar.zst
bun-a9c41c67e639714fbb4d7764e18be37615280c08.zip
Fix several bugs (#2418)
* utf16 codepoint with replacement character * Fix test failure with `TextEncoder("ascii')` * Add missing type * Fix Response.prototype.bodyUsed and Request.prototype.bodyUsed * Fix bug with scrypt error not clearing * Update server.zig * oopsie
Diffstat (limited to 'test/js/web/encoding/text-encoder.test.js')
-rw-r--r--test/js/web/encoding/text-encoder.test.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/js/web/encoding/text-encoder.test.js b/test/js/web/encoding/text-encoder.test.js
index 3d271026d..1bf2057bc 100644
--- a/test/js/web/encoding/text-encoder.test.js
+++ b/test/js/web/encoding/text-encoder.test.js
@@ -13,6 +13,15 @@ const getByteLength = str => {
return s;
};
+it("not enough space for replacement character", () => {
+ const encoder = new TextEncoder();
+ const bytes = new Uint8Array(2);
+ const result = encoder.encodeInto("\udc00", bytes);
+ expect(result.read).toBe(0);
+ expect(result.written).toBe(0);
+ expect(Array.from(bytes)).toEqual([0x00, 0x00]);
+});
+
describe("TextEncoder", () => {
it("should encode latin1 text with non-ascii latin1 characters", () => {
var text = "H©ell©o Wor©ld!";