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

Fix CSV test

This commit is contained in:
Dave Conway-Jones 2016-06-14 23:20:09 +01:00
parent 9e96eba98f
commit 8f2f3bf75d

View File

@ -54,7 +54,7 @@ describe('CSV node', 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, c: 3, d: 4 });
msg.should.have.property('payload', { a: '1', b: '2', c: '3', d: '4' });
done();
});
var testString = "1,2,3,4"+String.fromCharCode(10);
@ -69,7 +69,7 @@ describe('CSV node', 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, c: 3, d: 4 });
msg.should.have.property('payload', { a: '1', b: '2', c: '3', d: '4' });
done();
});
var testString = "1,2,3,4"+String.fromCharCode(10);
@ -84,7 +84,7 @@ describe('CSV node', function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.property('payload', { col1: 1, col2: 2, col3: 3, col4: 4 });
msg.should.have.property('payload', { col1: '1', col2: '2', col3: '3', col4: '4' });
done();
});
var testString = "1,2,3,4"+String.fromCharCode(10);
@ -99,7 +99,7 @@ describe('CSV node', function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.property('payload', { a: 1, d: 4 });
msg.should.have.property('payload', { a: '1', d: '4' });
done();
});
var testString = "1,2,3,4"+String.fromCharCode(10);
@ -115,7 +115,8 @@ describe('CSV node', 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, c: '+3', d: 4, e: -5, f: 'ab"cd', g: 'with,a,comma' });
//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 = '"1","-2","+3","04","-05",ab""cd,"with,a,comma"'+String.fromCharCode(10);
@ -133,11 +134,11 @@ describe('CSV node', function() {
n2.on("input", function(msg) {
//console.log(msg);
if (c === 0) {
msg.should.have.property('payload', { w: 1, x: 2, y: 3, z: 4 });
msg.should.have.property('payload', { w: '1', x: '2', y: '3', z: '4' });
c += 1;
}
else {
msg.should.have.property('payload', { w: 5, x: 6, y: 7, z: 8 });
msg.should.have.property('payload', { w: '5', x: '6', y: '7', z: '8' });
done();
}
});
@ -153,8 +154,7 @@ describe('CSV node', 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 },{ a: 5, b: -6, c: 7, d: '+8' },{ a: 9, b: 0, c: 'a', d: 'b' },{ a: 'c', b: 'd', c: 'e', d: 'f' } ]);
msg.should.have.property('payload', [ { a: '1', b: '2', c: '3', d: '4' },{ a: '5', b: '-6', c: 7, d: '+8' },{ a: '9', b: '0', c: 'a', d: 'b' },{ a: 'c', b: 'd', c: 'e', d: 'f' } ]);
done();
});
var testString = "1,2,3,4\n5,-6,07,+8\n9,0,a,b\nc,d,e,f";