Skip to content

Commit f5af22c

Browse files
committed
Merge pull request #96 from jondayft/csv-empty-quoutes-test
Adding test for empty string case
2 parents 6b2df10 + 96c75a1 commit f5af22c

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

test/data/dataWithEmptyString

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
green,40, ""

test/testCSVConverter.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,4 +335,21 @@ describe("CSV Converter", function () {
335335
done();
336336
});
337337
})
338+
it ("should handle when there is an empty string",function(done){
339+
var testData = __dirname + "/data/dataWithEmptyString";
340+
var rs = fs.createReadStream(testData);
341+
var st = rs.pipe(new Converter({
342+
noheader:true,
343+
headers:["a","b", "c"]
344+
}));
345+
st.on("end_parsed",function (res){
346+
var j = res[0];
347+
348+
assert(res.length===2);
349+
assert(j.a==="green");
350+
assert(j.b===40);
351+
assert(j.c==="");
352+
done();
353+
});
354+
})
338355
});

0 commit comments

Comments
 (0)