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

Merge pull request #2964 from node-red-hitachi/fix-grunt-error-on-exec-node

fix grunt fail on exec node test
This commit is contained in:
Nick O'Leary 2021-04-28 21:02:23 +01:00 committed by GitHub
commit ad316ffd37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -541,14 +541,18 @@ describe('exec node', function() {
var n2 = helper.getNode("n2"); var n2 = helper.getNode("n2");
var n3 = helper.getNode("n3"); var n3 = helper.getNode("n3");
var n4 = helper.getNode("n4"); var n4 = helper.getNode("n4");
var payload = "";
n2.on("input", function(msg) { n2.on("input", function(msg) {
//console.log(msg); //console.log(msg);
try { try {
msg.should.have.property("payload"); msg.should.have.property("payload");
msg.payload.should.be.a.String(); msg.payload.should.be.a.String();
msg.payload.should.equal(expected); payload += msg.payload;
if (payload.endsWith("\n")) {
payload.should.equal(expected);
done(); done();
} }
}
catch(err) { done(err); } catch(err) { done(err); }
}); });
n1.receive({payload:"hello world"}); n1.receive({payload:"hello world"});
@ -567,6 +571,7 @@ describe('exec node', function() {
{id:"n2", type:"helper"},{id:"n3", type:"helper"},{id:"n4", type:"helper"}]; {id:"n2", type:"helper"},{id:"n3", type:"helper"},{id:"n4", type:"helper"}];
expected = "12345 deg C\n"; expected = "12345 deg C\n";
} }
var payload = "";
helper.load(execNode, flow, function() { helper.load(execNode, flow, function() {
var n1 = helper.getNode("n1"); var n1 = helper.getNode("n1");
@ -578,9 +583,12 @@ describe('exec node', function() {
try { try {
msg.should.have.property("payload"); msg.should.have.property("payload");
msg.payload.should.be.a.String(); msg.payload.should.be.a.String();
msg.payload.should.equal(expected); payload += msg.payload;
if (payload.endsWith("\n")) {
payload.should.equal(expected);
done(); done();
} }
}
catch(err) { done(err); } catch(err) { done(err); }
}); });
n1.receive({payload:12345}); n1.receive({payload:12345});
@ -661,8 +669,16 @@ describe('exec node', function() {
}; };
n2.on("input", function(msg) { n2.on("input", function(msg) {
var payload = msg.payload;
if (messages[0]) {
messages[0].payload += payload;
}
else {
messages[0] = msg; messages[0] = msg;
}
if (payload.endsWith("\n")) {
completeTest(); completeTest();
}
}); });
n4.on("input", function(msg) { n4.on("input", function(msg) {
messages[1] = msg; messages[1] = msg;
@ -869,8 +885,16 @@ describe('exec node', function() {
}; };
n2.on("input", function(msg) { n2.on("input", function(msg) {
var payload = msg.payload;
if (messages[0]) {
messages[0].payload += payload;
}
else {
messages[0] = msg; messages[0] = msg;
}
if (payload.endsWith("\n")) {
completeTest(); completeTest();
}
}); });
n4.on("input", function(msg) { n4.on("input", function(msg) {
messages[1] = msg; messages[1] = msg;