aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar alexlamsl <alexlamsl@gmail.com> 2023-01-06 06:51:21 +0200
committerGravatar alexlamsl <alexlamsl@gmail.com> 2023-01-07 12:39:32 +0200
commitd5565ab2cdd7099a5852ba5ba6d180ef291af084 (patch)
tree6f1745d1664c2be53daddaab91433baf70c59a97
parent8dc811e4aa3b5e8e6c17914e465d0af5ac52aeb3 (diff)
downloadbun-d5565ab2cdd7099a5852ba5ba6d180ef291af084.tar.gz
bun-d5565ab2cdd7099a5852ba5ba6d180ef291af084.tar.zst
bun-d5565ab2cdd7099a5852ba5ba6d180ef291af084.zip
test `BufferList` against surrogate pairs
-rw-r--r--test/bun.js/bufferlist.test.ts16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/bun.js/bufferlist.test.ts b/test/bun.js/bufferlist.test.ts
index 3aa20845b..c533ae21c 100644
--- a/test/bun.js/bufferlist.test.ts
+++ b/test/bun.js/bufferlist.test.ts
@@ -213,13 +213,19 @@ it("should work with partial .consume() followed by .shift()", () => {
it("should work with partial .consume() followed by .unshift()", () => {
const list = new Readable().readableBuffer;
expect(list.length).toBe(0);
- expect(list.push(makeUint8Array("foo"))).toBeUndefined();
- expect(list.push(makeUint8Array("bar"))).toBeUndefined();
+ expect(list.push(makeUint8Array("😋😋😋"))).toBeUndefined();
+ expect(list.push(makeUint8Array("📋📋📋"))).toBeUndefined();
expect(list.length).toBe(2);
- expect(list.consume(4, false)).toEqual(makeUint8Array("foob"));
+ expect(list.consume(7, false)).toEqual(new Uint8Array([
+ 61, 11, 61, 11, 61, 11,
+ 61,
+ ]));
expect(list.length).toBe(1);
- expect(list.unshift(makeUint8Array("baz"))).toBeUndefined();
+ expect(list.unshift(makeUint8Array("👌👌👌"))).toBeUndefined();
expect(list.length).toBe(2);
- expect(list.consume(5, false)).toEqual(makeUint8Array("bazar"));
+ expect(list.consume(12, false)).toEqual(new Uint8Array([
+ 61, 76, 61, 76, 61, 76,
+ 203, 61, 203, 61, 203, 0,
+ ]));
expect(list.length).toBe(0);
});