From: Ardis Lu Date: Tue, 28 Jan 2025 06:10:24 +0000 (-0800) Subject: Add test for raising non-error rejection X-Git-Tag: v0.1.0~80 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=58f2eb0c2e3c49d601703f1522ba68b1ca7dbac5;p=csvio Add test for raising non-error rejection --- diff --git a/test/core.test.js b/test/core.test.js index 3ff4edb..75b298f 100644 --- a/test/core.test.js +++ b/test/core.test.js @@ -339,6 +339,20 @@ suite('CSVTransformer', { concurrency: true }, () => { { name: 'Error', message: 'inner' } ); }); + test('raises new error if transformation function rejects with non-error type', { concurrency: true }, async () => { + await rejects( + createCSVMockStream([ + ['columnA'], + ['1'] + ]) + .pipeThrough(new CSVTransformer(() => Promise.reject('Not an error type'))) + .pipeTo(csvStreamEqualWritable([ + ['columnA'], + ['1'] + ])), + { name: 'Error', message: 'Not an error type' } + ); + }); test('creates one batch when maxBatchSize is greater than CSV row length', { concurrency: true }, async () => { await createCSVMockStream([ ['columnA', 'columnB'],