mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	CSV Add couple more special character tests just to make sure
This commit is contained in:
		| @@ -222,6 +222,40 @@ describe('CSV node', function() { | ||||
|             }); | ||||
|         }); | ||||
|  | ||||
|         it('should allow passing in a template as first line of CSV (special char /)', function(done) { | ||||
|             var flow = [ { id:"n1", type:"csv", temp:"", hdrin:true, sep:"/", 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 b":2, "c/c":3, "d, d": 4 }); | ||||
|                     msg.should.have.property('columns', 'a,b b,c/c,"d, d"'); | ||||
|                     check_parts(msg, 0, 1); | ||||
|                     done(); | ||||
|                 }); | ||||
|                 var testString = 'a/b b/"c/c"/" d, d "'+"\n"+"1/2/3/4"+String.fromCharCode(10); | ||||
|                 n1.emit("input", {payload:testString}); | ||||
|             }); | ||||
|         }); | ||||
|  | ||||
|         it('should allow passing in a template as first line of CSV (special char \\)', function(done) { | ||||
|             var flow = [ { id:"n1", type:"csv", temp:"", hdrin:true, sep:"\\", 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 b":2, "c\\c":3, "d, d": 4 }); | ||||
|                     msg.should.have.property('columns', 'a,b b,c\\c,"d, d"'); | ||||
|                     check_parts(msg, 0, 1); | ||||
|                     done(); | ||||
|                 }); | ||||
|                 var testString = 'a\\b b\\"c\\c"\\" d, d "'+"\n"+"1\\2\\3\\4"+String.fromCharCode(10); | ||||
|                 n1.emit("input", {payload:testString}); | ||||
|             }); | ||||
|         }); | ||||
|  | ||||
|         it('should leave numbers starting with 0, e and + as strings (except 0.)', function(done) { | ||||
|             var flow = [ { id:"n1", type:"csv", temp:"a,b,c,d,e,f,g", wires:[["n2"]] }, | ||||
|                 {id:"n2", type:"helper"} ]; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user