Skip to content

Commit e8155c3

Browse files
committed
test(core/serde): add unit test for string chunk handling
1 parent fe862bd commit e8155c3

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

packages/core/src/submodules/serde/util-stream/checksum/ChecksumStream.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,28 @@ describe(ChecksumStream.name, () => {
274274
});
275275
});
276276

277+
describe("string chunks", () => {
278+
it("should handle string chunks from the source by converting them to Buffer", async () => {
279+
const source = new Readable({
280+
read() {
281+
this.push("abcdefghijklm");
282+
this.push("nopqrstuvwxyz");
283+
this.push(null);
284+
},
285+
});
286+
287+
const checksumStream = new ChecksumStream({
288+
expectedChecksum: canonicalBase64,
289+
checksum: new Appender(),
290+
checksumSourceLocation: "my-header",
291+
source,
292+
});
293+
294+
const collected = toUtf8(await collect(checksumStream));
295+
expect(collected).toEqual(canonicalUtf8);
296+
});
297+
});
298+
277299
describe("backpressure", () => {
278300
it("should only read from the source at the rate it is consumed", async () => {
279301
// for Node.js 22+ increased default highwater mark.

0 commit comments

Comments
 (0)