]> git.ardis.lu - csvio/commitdiff
Fix bug where extra normalization headers were not dropped
authorArdis Lu <ardisglu@gmail.com>
Wed, 9 Jul 2025 05:42:01 +0000 (22:42 -0700)
committerArdis Lu <ardisglu@gmail.com>
Wed, 9 Jul 2025 05:42:01 +0000 (22:42 -0700)
This bug was not caught due to a separate bug in the test logic, which is also fixed in this commit.

src/normalization.js
test/utils.js

index 62288327442630fe580481514251c576b43bdaa1..8ddbfbf17a2ca78e86e7e7ab4fe06b4c56d050e5 100644 (file)
@@ -154,7 +154,7 @@ export class CSVNormalizer extends TransformStream {
         }
         i++;
       }
-      this.#columns.filter(c => c.index !== null); // Drop columns provided in the headers input but not in the CSV
+      this.#columns = this.#columns.filter(c => c.index !== null); // Drop columns provided in the headers input but not in the CSV
       this.#firstChunk = false;
       return;
     }
index 45f2531defcb528856ba73a9f44a75d01fee6ee2..a56f73966f23fcb3131ec54f27e4d881275009c2 100644 (file)
@@ -20,6 +20,7 @@ export function csvStreamEqualWritable(csv) {
   return new WritableStream({
     write(chunk) {
       const row = JSON.parse(chunk);
+      deepStrictEqual(row.length, csv[i].length);
       for (let j = 0; j < csv[i].length; j++) {
         deepStrictEqual(row[j], csv[i][j]);
       }
This page took 0.036825 seconds and 4 git commands to generate.