]> git.ardis.lu - csvio/commitdiff
Add test for raising non-error rejection
authorArdis Lu <ardisglu@gmail.com>
Tue, 28 Jan 2025 06:10:24 +0000 (22:10 -0800)
committerArdis Lu <ardisglu@gmail.com>
Tue, 28 Jan 2025 06:10:24 +0000 (22:10 -0800)
test/core.test.js

index 3ff4edba784cf0573b92f4171ba6be65e01322b5..75b298f17daba12935af8ded53926c12a9a5a75e 100644 (file)
@@ -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'],
This page took 0.043634 seconds and 4 git commands to generate.