Skip to content

Commit

Permalink
fix #130: pass absolute line-number to data-invalid handler (adapted …
Browse files Browse the repository at this point in the history
…test)
  • Loading branch information
Christoph Wanasek authored and doug-martin committed Jul 28, 2019
1 parent 06bffe5 commit c8865f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/parser/CsvParserStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export default class CsvParserStream extends Transform {
return cb(new Error('expected transform result'));
}
if (!transformResult.isValid) {
this.rowCount -= 1;
this.emit('data-invalid', transformResult.row, nextRowCount, transformResult.reason);
} else if (!transformResult.row) {
this.rowCount -= 1;
Expand Down
6 changes: 3 additions & 3 deletions test/parser/CsvParsingStream.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ describe('CsvParserStream', () => {
.then(({ count, rows, invalidRows }) => {
assert.deepStrictEqual(rows, expectedRows);
assert.deepStrictEqual(invalidRows, expectedInvalidRows);
assert.strictEqual(count, rows.length);
assert.strictEqual(count, rows.length + invalidRows.length);
});
});

Expand Down Expand Up @@ -280,7 +280,7 @@ describe('CsvParserStream', () => {
.then(({ count, rows, invalidRows }) => {
assert.deepStrictEqual(invalidRows, invalidValid[1]);
assert.deepStrictEqual(rows, invalidValid[0]);
assert.strictEqual(count, invalidValid[0].length);
assert.strictEqual(count, invalidValid[0].length + invalidValid[1].length);
});
});

Expand All @@ -294,7 +294,7 @@ describe('CsvParserStream', () => {
.then(({ count, rows, invalidRows }) => {
assert.deepStrictEqual(invalidRows, invalidValid[1]);
assert.deepStrictEqual(rows, invalidValid[0]);
assert.strictEqual(count, invalidValid[0].length);
assert.strictEqual(count, invalidValid[0].length + invalidValid[1].length);
});
});

Expand Down

0 comments on commit c8865f7

Please sign in to comment.