From 5a88c912cfef618bda66adad5b5c797c7269d8a2 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Tue, 8 Jul 2025 22:42:01 -0700 Subject: [PATCH] Fix bug where extra normalization headers were not dropped This bug was not caught due to a separate bug in the test logic, which is also fixed in this commit. --- src/normalization.js | 2 +- test/utils.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/normalization.js b/src/normalization.js index 6228832..8ddbfbf 100644 --- a/src/normalization.js +++ b/src/normalization.js @@ -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; } diff --git a/test/utils.js b/test/utils.js index 45f2531..a56f739 100644 --- a/test/utils.js +++ b/test/utils.js @@ -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]); } -- 2.47.3