mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add tests
This commit is contained in:
parent
8c19daf949
commit
bda5dffa34
@ -121,6 +121,19 @@ describe('TCP in Node', function() {
|
||||
testTCP0(flow, ["foo\nbar"], ["foo", "bar"], done);
|
||||
});
|
||||
|
||||
it('should recv data (Stream/String/Delimiter:o\\n)', function(done) {
|
||||
var flow = [{id:"n1", type:"tcp in", server:"server", host:"localhost", port:port, datamode:"stream", datatype:"utf8", newline:"o\n", topic:"", base64:false, wires:[["n2"]] },
|
||||
{id:"n2", type:"helper"}];
|
||||
testTCP0(flow, ["foo\nbar"], ["fo", "bar"], done);
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
|
||||
it('should recv data (Stream/String/No delimiter)', function(done) {
|
||||
var flow = [{id:"n1", type:"tcp in", server:"server", host:"localhost", port:port, datamode:"stream", datatype:"utf8", newline:"", topic:"", base64:false, wires:[["n2"]] },
|
||||
{id:"n2", type:"helper"}];
|
||||
|
@ -277,6 +277,21 @@ describe('TCP Request Node', function() {
|
||||
}, {
|
||||
payload: "bar<A>\nfoo",
|
||||
topic: 'boo'
|
||||
}], {
|
||||
payload: "ACK:foobar",
|
||||
topic: 'boo'
|
||||
}, done);
|
||||
});
|
||||
|
||||
it('should send & receive, then keep connection, and split return strings and reattach delimiter', function(done) {
|
||||
var flow = [{id:"n1", type:"tcp request", server:"localhost", port:port, out:"sit", ret:"string", newline:"<A>\\n", trim:true, wires:[["n2"]] },
|
||||
{id:"n2", type:"helper"}];
|
||||
testTCPMany(flow, [{
|
||||
payload: "foo",
|
||||
topic: 'boo'
|
||||
}, {
|
||||
payload: "bar<A>\nfoo",
|
||||
topic: 'boo'
|
||||
}], {
|
||||
payload: "ACK:foobar<A>",
|
||||
topic: 'boo'
|
||||
|
Loading…
Reference in New Issue
Block a user