mirror of
https://github.com/node-red/node-red.git
synced 2025-12-27 15:34:26 +01:00
Apply suggestions from code review
This commit is contained in:
@@ -1437,7 +1437,7 @@ describe('function node', function() {
|
||||
var logEvents = helper.log().args.filter(function(evt) {
|
||||
return evt[0].type == "function";
|
||||
});
|
||||
logEvents.should.have.length(2);
|
||||
logEvents.should.have.length(1);
|
||||
var msg = logEvents[0][0];
|
||||
msg.should.have.property('level', helper.log().ERROR);
|
||||
msg.should.have.property('id', 'n1');
|
||||
@@ -1463,7 +1463,7 @@ describe('function node', function() {
|
||||
var logEvents = helper.log().args.filter(function (evt) {
|
||||
return evt[0].type == "function";
|
||||
});
|
||||
logEvents.should.have.length(2);
|
||||
logEvents.should.have.length(1);
|
||||
var msg = logEvents[0][0];
|
||||
msg.should.have.property('level', helper.log().ERROR);
|
||||
msg.should.have.property('id', 'n1');
|
||||
@@ -1480,7 +1480,7 @@ describe('function node', function() {
|
||||
});
|
||||
|
||||
it('check if default function timeout settings are recognized', function (done) {
|
||||
RED.settings.defaultFunctionTimeout = 0.01;
|
||||
RED.settings.globalFunctionTimeout = 0.01;
|
||||
var flow = [{id: "n1",type: "function",wires: [["n2"]],func: "while(1==1){};\nreturn msg;"}];
|
||||
helper.load(functionNode, flow, function () {
|
||||
var n1 = helper.getNode("n1");
|
||||
@@ -1491,14 +1491,14 @@ describe('function node', function() {
|
||||
var logEvents = helper.log().args.filter(function (evt) {
|
||||
return evt[0].type == "function";
|
||||
});
|
||||
logEvents.should.have.length(2);
|
||||
logEvents.should.have.length(1);
|
||||
var msg = logEvents[0][0];
|
||||
msg.should.have.property('level', helper.log().ERROR);
|
||||
msg.should.have.property('id', 'n1');
|
||||
msg.should.have.property('type', 'function');
|
||||
should.equal(RED.settings.defaultFunctionTimeout, 0.01);
|
||||
should.equal(RED.settings.globalFunctionTimeout, 0.01);
|
||||
should.equal(msg.msg.message, 'Script execution timed out after 10ms');
|
||||
delete RED.settings.defaultFunctionTimeout;
|
||||
delete RED.settings.globalFunctionTimeout;
|
||||
done();
|
||||
} catch (err) {
|
||||
done(err);
|
||||
@@ -1508,7 +1508,7 @@ describe('function node', function() {
|
||||
});
|
||||
|
||||
it('check if functionTimeout has higher precedence over default function timeout setting', function (done) {
|
||||
RED.settings.defaultFunctionTimeout = 0.02;
|
||||
RED.settings.globalFunctionTimeout = 0.02;
|
||||
RED.settings.functionTimeout = 0.01;
|
||||
var flow = [{id: "n1",type: "function",timeout: RED.settings.functionTimeout,wires: [["n2"]],func: "while(1==1){};\nreturn msg;"}];
|
||||
helper.load(functionNode, flow, function () {
|
||||
@@ -1520,16 +1520,16 @@ describe('function node', function() {
|
||||
var logEvents = helper.log().args.filter(function (evt) {
|
||||
return evt[0].type == "function";
|
||||
});
|
||||
logEvents.should.have.length(2);
|
||||
logEvents.should.have.length(1);
|
||||
var msg = logEvents[0][0];
|
||||
msg.should.have.property('level', helper.log().ERROR);
|
||||
msg.should.have.property('id', 'n1');
|
||||
msg.should.have.property('type', 'function');
|
||||
should.equal(RED.settings.functionTimeout, 0.01);
|
||||
should.equal(RED.settings.defaultFunctionTimeout, 0.02);
|
||||
should.equal(RED.settings.globalFunctionTimeout, 0.02);
|
||||
should.equal(msg.msg.message, 'Script execution timed out after 10ms');
|
||||
delete RED.settings.functionTimeout;
|
||||
delete RED.settings.defaultFunctionTimeout;
|
||||
delete RED.settings.globalFunctionTimeout;
|
||||
done();
|
||||
} catch (err) {
|
||||
done(err);
|
||||
|
||||
Reference in New Issue
Block a user