]> git.ardis.lu - csvio/commitdiff
Add test case for raw strings passed to `TransformStream` CSVWriter
authorArdis Lu <ardisglu@gmail.com>
Mon, 18 Aug 2025 03:08:26 +0000 (20:08 -0700)
committerArdis Lu <ardisglu@gmail.com>
Mon, 18 Aug 2025 03:08:26 +0000 (20:08 -0700)
test/core.test.js

index 510b032f2fde9f16319bbdce8ad0dafe9c357776..de0e3390b765efcded945112a5c678c4806b3d60 100644 (file)
@@ -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
This page took 0.038583 seconds and 4 git commands to generate.