Skip to content

Commit

Permalink
Better fix for css, reverting test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Conway-Jones committed Jun 14, 2016
1 parent 8f2f3bf commit e4d5271
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion nodes/core/parsers/70-CSV.js
Expand Up @@ -112,7 +112,7 @@ module.exports = function(RED) {
var first = true; // is this the first line
var line = msg.payload;
var tmp = "";
var reg = new RegExp("^[-]?[0-9.]+[\.]?[0-9]+$");
var reg = new RegExp("^[-]?[0-9.]*[\.]?[0-9]*$");

// For now we are just going to assume that any \r or \n means an end of line...
// got to be a weird csv that has singleton \r \n in it for another reason...
Expand Down
16 changes: 8 additions & 8 deletions test/nodes/core/parsers/70-CSV_spec.js
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -116,7 +116,7 @@ describe('CSV node', function() {
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' });
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);
Expand All @@ -134,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();
}
});
Expand All @@ -154,7 +154,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' },{ 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";
Expand Down

0 comments on commit e4d5271

Please sign in to comment.