From: Ardis Lu Date: Sat, 12 Jul 2025 04:55:20 +0000 (-0700) Subject: Add explicit test for `passthroughEmptyRows` X-Git-Tag: v0.1.4~8 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=cdd6bd1b62cdc1d0438511109eb9aeabb38593dc;p=csvio Add explicit test for `passthroughEmptyRows` --- diff --git a/test/normalization.test.js b/test/normalization.test.js index fd7ef7a..5b02ced 100644 --- a/test/normalization.test.js +++ b/test/normalization.test.js @@ -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', '', ''],