From e601053134db814b145aaaf90cb61a99bdd4dfe6 Mon Sep 17 00:00:00 2001 From: Demetris Manikas Date: Fri, 1 May 2020 14:33:41 +0300 Subject: [PATCH] add test to check for empty field in the begining --- tests/test-cases.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test-cases.js b/tests/test-cases.js index 4f6550ab..18ec3801 100644 --- a/tests/test-cases.js +++ b/tests/test-cases.js @@ -732,6 +732,23 @@ var PARSE_TESTS = [ }] } }, + { + description: "Row with enough fields but blank field in the begining", + input: 'A,B,C\r\n,b1,c1\r\na2,b2,c2', + expected: { + data: [["A", "B", "C"], ['', 'b1', 'c1'], ['a2', 'b2', 'c2']], + errors: [] + } + }, + { + description: "Row with enough fields but blank field in the begining using headers", + input: 'A,B,C\r\n,b1,c1\r\n,b2,c2', + config: { header: true }, + expected: { + data: [{"A": "", "B": "b1", "C": "c1"}, {"A": "", "B": "b2", "C": "c2"}], + errors: [] + } + }, { description: "Row with enough fields but blank field at end", input: 'A,B,C\r\na,b,',