mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
add extra test for CSV with odd quotes
This commit is contained in:
parent
82269462a4
commit
b74a35b9d1
@ -124,6 +124,24 @@ describe('CSV node', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should recover from an odd number of quotes in the input', function(done) {
|
||||||
|
var flow = [ { id:"n1", type:"csv", temp:"a,b,c,d,e,f,g", wires:[["n2"]] },
|
||||||
|
{id:"n2", type:"helper"} ];
|
||||||
|
helper.load(csvNode, flow, function() {
|
||||||
|
var n1 = helper.getNode("n1");
|
||||||
|
var n2 = helper.getNode("n2");
|
||||||
|
n2.on("input", function(msg) {
|
||||||
|
//console.log(msg);
|
||||||
|
msg.should.have.property('payload', { a: 1, b: -2, c: '+3', d: 4, e: -5, f: 'ab"cd', g: 'with,a,comma' });
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
var testString = '"with,a"n,odd",num"ber,of"quotes'+String.fromCharCode(10);
|
||||||
|
n1.emit("input", {payload:testString});
|
||||||
|
testString = '"1","-2","+3","04","-05",ab""cd,"with,a,comma"'+String.fromCharCode(10);
|
||||||
|
n1.emit("input", {payload:testString});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should be able to use the first line as a template', function(done) {
|
it('should be able to use the first line as a template', function(done) {
|
||||||
var flow = [ { id:"n1", type:"csv", temp:"a,b,c,d", hdrin:true, wires:[["n2"]] },
|
var flow = [ { id:"n1", type:"csv", temp:"a,b,c,d", hdrin:true, wires:[["n2"]] },
|
||||||
{id:"n2", type:"helper"} ];
|
{id:"n2", type:"helper"} ];
|
||||||
@ -219,7 +237,7 @@ describe('CSV node', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should convert aan array of arrays back to a multi-line csv', function(done) {
|
it('should convert an array of arrays back to a multi-line csv', function(done) {
|
||||||
var flow = [ { id:"n1", type:"csv", temp:"a,b,c,d", wires:[["n2"]] },
|
var flow = [ { id:"n1", type:"csv", temp:"a,b,c,d", wires:[["n2"]] },
|
||||||
{id:"n2", type:"helper"} ];
|
{id:"n2", type:"helper"} ];
|
||||||
helper.load(csvNode, flow, function() {
|
helper.load(csvNode, flow, function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user