mirror of
https://github.com/oven-sh/bun
synced 2026-02-18 23:01:58 +00:00
26 lines
711 B
JavaScript
26 lines
711 B
JavaScript
//#FILE: test-stream-decoder-objectmode.js
|
|
//#SHA1: 373c0c494e625b8264fae296b46f16a5cd5a9ef8
|
|
//-----------------
|
|
"use strict";
|
|
|
|
const stream = require("stream");
|
|
|
|
test("stream.Readable with objectMode and utf16le encoding", () => {
|
|
const readable = new stream.Readable({
|
|
read: () => {},
|
|
encoding: "utf16le",
|
|
objectMode: true,
|
|
});
|
|
|
|
readable.push(Buffer.from("abc", "utf16le"));
|
|
readable.push(Buffer.from("def", "utf16le"));
|
|
readable.push(null);
|
|
|
|
// Without object mode, these would be concatenated into a single chunk.
|
|
expect(readable.read()).toBe("abc");
|
|
expect(readable.read()).toBe("def");
|
|
expect(readable.read()).toBeNull();
|
|
});
|
|
|
|
//<#END_FILE: test-stream-decoder-objectmode.js
|