]> git.ardis.lu - csvio/commitdiff
Add explicit test for `passthroughEmptyRows`
authorArdis Lu <ardisglu@gmail.com>
Sat, 12 Jul 2025 04:55:20 +0000 (21:55 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sat, 12 Jul 2025 04:55:20 +0000 (21:55 -0700)
test/normalization.test.js

index fd7ef7a7b735e8d877ac88db99daa883a4684ce9..5b02cedfa993eaf5b77a25a647f19646797c47bd 100644 (file)
@@ -258,6 +258,29 @@ suite('CSVNormalizer', { concurrency: true }, () => {
         ['a', 'b']
       ]));
   });
+  test('passes through empty rows when passthroughEmptyRows is true', { concurrency: true }, async () => {
+    await createCSVMockStream([
+      ['columnA', 'columnB'],
+      ['', ''],
+      ['a', 'b'],
+      ['', ''],
+      ['', ''],
+      ['', '']
+    ])
+      .pipeThrough(new CSVNormalizer([
+        { name: 'columnA', type: 'string' },
+        { name: 'columnB', type: 'string' }
+      ], { passthroughEmptyRows: true }))
+      .pipeThrough(new CSVDenormalizer())
+      .pipeTo(csvStreamEqualWritable([
+        ['columnA', 'columnB'],
+        ['', ''],
+        ['a', 'b'],
+        ['', ''],
+        ['', ''],
+        ['', '']
+      ]));
+  });
   test('can remove empty columns', { concurrency: true }, async () => {
     await createCSVMockStream([
       ['columnA', '', 'columnB', '', ''],
This page took 0.035015 seconds and 4 git commands to generate.