From 747e09341009d8de1800e3b0ee4828aefe91b28f Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Wed, 9 Jul 2025 23:07:03 -0700 Subject: [PATCH] Add explicit test for sparse CSV --- test/normalization.test.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/normalization.test.js b/test/normalization.test.js index c57f353..a2e2466 100644 --- a/test/normalization.test.js +++ b/test/normalization.test.js @@ -273,6 +273,26 @@ suite('CSVNormalizer', { concurrency: true }, () => { ['a', 'b'] ])); }); + test('handles sparse CSV', { concurrency: true }, async () => { + await createCSVMockStream([ + ['sparse1', 'sparse2', 'sparse3'], + ['s1', '', ''], + ['', 's2', ''], + ['', '', 's3'] + ]) + .pipeThrough(new CSVNormalizer([ + { name: 'sparse1', type: 'string' }, + { name: 'sparse2', type: 'string' }, + { name: 'sparse3', type: 'string' }, + ])) + .pipeThrough(new CSVDenormalizer()) + .pipeTo(csvStreamEqualWritable([ + ['sparse1', 'sparse2', 'sparse3'], + ['s1', '', ''], + ['', 's2', ''], + ['', '', 's3'] + ])); + }); test('defaults to "string" type', { concurrency: true }, async () => { await createCSVMockStream([ ['columnA', 'columnB'], -- 2.47.3