From cdd6bd1b62cdc1d0438511109eb9aeabb38593dc Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Fri, 11 Jul 2025 21:55:20 -0700 Subject: [PATCH] Add explicit test for `passthroughEmptyRows` --- test/normalization.test.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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', '', ''], -- 2.47.3