-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5274a96
commit ed0f862
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { EOL } from 'os'; | ||
import * as assert from 'assert'; | ||
import { Parser } from '../../src/parser/parser'; | ||
import { ParserOptions, ParserOptionsArgs } from '../../src/parser'; | ||
|
||
|
||
describe('Issue #174 - https://github.com/C2FO/fast-csv/issues/174', () => { | ||
const createParser = (parserOptions: ParserOptionsArgs = {}) => new Parser(new ParserOptions(parserOptions)); | ||
const runParser = (data: string, hasMoreData: boolean, parser: Parser) => parser.parse(data, hasMoreData); | ||
|
||
const CSV_CONTENT = [ | ||
'f1,f2,f3', | ||
'1,text, a1', | ||
'2,text, a2 ', | ||
].join(EOL); | ||
|
||
it('skip trailing whitespace after a quoted field', () => { | ||
const parser = createParser({ headers: true }); | ||
const parsedData = runParser(CSV_CONTENT, false, parser); | ||
assert.deepStrictEqual(parsedData, { | ||
line: '', | ||
rows: [ | ||
[ 'f1', 'f2', 'f3' ], | ||
[ '1', 'text', ' a1' ], | ||
[ '2', 'text', ' a2 ' ], | ||
], | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters