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

Modify trigger spec timings to reduce false-positive test runs

This commit is contained in:
Nick O'Leary 2019-03-05 09:48:13 +00:00
parent 749db6ba82
commit fab796e4e4
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -663,7 +663,7 @@ describe('trigger node', function() {
}); });
it('should be able to extend the delay (but with no 2nd output)', function(done) { it('should be able to extend the delay (but with no 2nd output)', function(done) {
var flow = [{"id":"n1", "type":"trigger", "name":"triggerNode", extend:"true", op1type:"pay", op2type:"nul", op1:"false", op2:"true", duration:"100", wires:[["n2"]] }, var flow = [{"id":"n1", "type":"trigger", "name":"triggerNode", extend:"true", op1type:"pay", op2type:"nul", op1:"false", op2:"true", duration:"200", wires:[["n2"]] },
{id:"n2", type:"helper"} ]; {id:"n2", type:"helper"} ];
helper.load(triggerNode, flow, function() { helper.load(triggerNode, flow, function() {
var n1 = helper.getNode("n1"); var n1 = helper.getNode("n1");
@ -677,20 +677,25 @@ describe('trigger node', function() {
} }
else { else {
msg.should.have.a.property("payload", "World"); msg.should.have.a.property("payload", "World");
(Date.now() - ss).should.be.greaterThan(149); (Date.now() - ss).should.be.greaterThan(300);
done(); done();
} }
} catch(err) {
console.log(err);
done(err);
} }
catch(err) { done(err); }
}); });
var ss = Date.now(); var ss = Date.now();
n1.emit("input", {payload:"Hello"}); n1.emit("input", {payload:"Hello"});
setTimeout( function() { setTimeout( function() {
n1.emit("input", {payload:"Error"}); n1.emit("input", {payload:"Error"});
},30); },50);
setTimeout( function() {
n1.emit("input", {payload:"Error"});
},100);
setTimeout( function() { setTimeout( function() {
n1.emit("input", {payload:"World"}); n1.emit("input", {payload:"World"});
},150); },330);
}); });
}); });