1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

add another test to csv

This commit is contained in:
Dave Conway-Jones 2021-04-25 08:53:18 +01:00
parent 9f1deb0c36
commit f8abf9fce1
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF

View File

@ -121,6 +121,23 @@ describe('CSV node', function() {
}); });
}); });
it('should convert a simple string to a javascript object with space separator (with spaced template)', function(done) {
var flow = [ { id:"n1", type:"csv", sep:" ", temp:"A, B, , D", 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) {
msg.should.have.property('payload', { A: 1, B: 2, D: 4 });
msg.should.have.property('columns', "A,B,D");
check_parts(msg, 0, 1);
done();
});
var testString = "1 2 3 4"+String.fromCharCode(10);
n1.emit("input", {payload:testString});
});
});
it('should remove quotes and whitespace from template', function(done) { it('should remove quotes and whitespace from template', 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"} ];