From: Ardis Lu Date: Mon, 18 Aug 2025 03:08:26 +0000 (-0700) Subject: Add test case for raw strings passed to `TransformStream` CSVWriter X-Git-Tag: v0.1.5~3 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=381772385d0540e6a263343aa3b8f78267d80f53;p=csvio Add test case for raw strings passed to `TransformStream` CSVWriter --- diff --git a/test/core.test.js b/test/core.test.js index 510b032..de0e339 100644 --- a/test/core.test.js +++ b/test/core.test.js @@ -827,4 +827,12 @@ suite('CSVWriter status', { concurrency: true }, () => { ['row 3', 'c'] ])); }); + test('counts raw CSV string as one row when TransformStream', { concurrency: true }, async (t) => { + const writer = new CSVWriter(); + const stream = createCSVMockStream([['']]) + .pipeThrough(new CSVTransformer(() => 'row 1,a\r\nrow 2,b\r\nrow 3,c', { handleHeaders: true })) + .pipeThrough(writer); + for await (const _ of stream) { } + deepStrictEqual(writer.status.rows, 1); + }); }); \ No newline at end of file