tcp node - undo trim if we re-add split chars

and fix tests
This commit is contained in:
Dave Conway-Jones
2022-03-23 22:07:43 +00:00
parent bda5dffa34
commit 8a40622815
6 changed files with 11 additions and 11 deletions

View File

@@ -130,7 +130,7 @@ describe('TCP in Node', function() {
it('should recv data (Stream/String/Delimiter:o\\n) and reattach o', function(done) {
var flow = [{id:"n1", type:"tcp in", server:"server", host:"localhost", port:port, datamode:"stream", datatype:"utf8", newline:"o\n", trim:true, topic:"", base64:false, wires:[["n2"]] },
{id:"n2", type:"helper"}];
testTCP0(flow, ["foo\nbar"], ["foo", "bar"], done);
testTCP0(flow, ["foo\nbar"], ["foo\n", "bar"], done);
});

View File

@@ -293,7 +293,7 @@ describe('TCP Request Node', function() {
payload: "bar<A>\nfoo",
topic: 'boo'
}], {
payload: "ACK:foobar<A>",
payload: "ACK:foobar<A>\n",
topic: 'boo'
}, done);
});

View File

@@ -45,7 +45,7 @@ describe('JSON node', function() {
msg.payload.employees[0].should.have.property('lastName', 'Smith');
done();
});
var jsonString = '{"employees":[{"firstName":"John", "lastName":"Smith"}]}';
var jsonString = ' {"employees":[{"firstName":"John", "lastName":"Smith"}]}\r\n ';
jn1.receive({payload:jsonString,topic: "bar"});
});
});
@@ -63,7 +63,7 @@ describe('JSON node', function() {
msg.payload.employees[0].should.have.property('lastName', 'Smith');
done();
});
var jsonString = Buffer.from('{"employees":[{"firstName":"John", "lastName":"Smith"}]}');
var jsonString = Buffer.from(' {"employees":[{"firstName":"John", "lastName":"Smith"}]}\r\n ');
jn1.receive({payload:jsonString,topic: "bar"});
});
});

View File

@@ -56,7 +56,7 @@ describe('XML node', function() {
should.equal(msg.payload.employees.lastName[0], 'Smith');
done();
});
var string = '<employees><firstName>John</firstName><lastName>Smith</lastName></employees>';
var string = ' <employees><firstName>John</firstName><lastName>Smith</lastName></employees>\r\n ';
n1.receive({payload:string,topic: "bar"});
});
});
@@ -76,7 +76,7 @@ describe('XML node', function() {
should.equal(msg.foo.employees.lastName[0], 'Smith');
done();
});
var string = '<employees><firstName>John</firstName><lastName>Smith</lastName></employees>';
var string = ' <employees><firstName>John</firstName><lastName>Smith</lastName></employees>\r\n ';
n1.receive({foo:string,topic: "bar"});
});
});
@@ -96,7 +96,7 @@ describe('XML node', function() {
should.equal(msg.payload.employees.lastName[0], 'Smith');
done();
});
var string = '<employees><firstName>John</firstName><lastName>Smith</lastName></employees>';
var string = ' <employees><firstName>John</firstName><lastName>Smith</lastName></employees>\r\n ';
n1.receive({payload:string, topic:"bar", options:{trim:true}});
});
});