mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix function node tests use of RED.settings
This commit is contained in:
parent
3d23d1de4f
commit
0566a2d9b1
@ -18,7 +18,7 @@ var should = require("should");
|
|||||||
var functionNode = require("nr-test-utils").require("@node-red/nodes/core/function/10-function.js");
|
var functionNode = require("nr-test-utils").require("@node-red/nodes/core/function/10-function.js");
|
||||||
var Context = require("nr-test-utils").require("@node-red/runtime/lib/nodes/context");
|
var Context = require("nr-test-utils").require("@node-red/runtime/lib/nodes/context");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
var RED = require("nr-test-utils").require("node-red/lib/red");
|
||||||
describe('function node', function() {
|
describe('function node', function() {
|
||||||
|
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
@ -1415,7 +1415,9 @@ describe('function node', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('externalModules', function() {
|
describe('externalModules', function() {
|
||||||
|
afterEach(function() {
|
||||||
|
delete RED.settings.functionExternalModules;
|
||||||
|
})
|
||||||
it('should fail if using OS module without functionExternalModules set to true', function(done) {
|
it('should fail if using OS module without functionExternalModules set to true', function(done) {
|
||||||
var flow = [
|
var flow = [
|
||||||
{id:"n1",type:"function",wires:[["n2"]],func:"msg.payload = os.type(); return msg;", "libs": [{var:"os", module:"os"}]},
|
{id:"n1",type:"function",wires:[["n2"]],func:"msg.payload = os.type(); return msg;", "libs": [{var:"os", module:"os"}]},
|
||||||
@ -1433,9 +1435,7 @@ describe('function node', function() {
|
|||||||
{id:"n1",type:"function",wires:[["n2"]],func:"msg.payload = os.type(); return msg;"},
|
{id:"n1",type:"function",wires:[["n2"]],func:"msg.payload = os.type(); return msg;"},
|
||||||
{id:"n2", type:"helper"}
|
{id:"n2", type:"helper"}
|
||||||
];
|
];
|
||||||
helper.settings({
|
RED.settings.functionExternalModules = true;
|
||||||
functionExternalModules: true
|
|
||||||
})
|
|
||||||
helper.load(functionNode, flow, function() {
|
helper.load(functionNode, flow, function() {
|
||||||
var n1 = helper.getNode("n1");
|
var n1 = helper.getNode("n1");
|
||||||
var n2 = helper.getNode("n2");
|
var n2 = helper.getNode("n2");
|
||||||
@ -1459,9 +1459,7 @@ describe('function node', function() {
|
|||||||
{id:"n1",type:"function",wires:[["n2"]],func:"msg.payload = os.type(); return msg;", "libs": [{var:"os", module:"os"}]},
|
{id:"n1",type:"function",wires:[["n2"]],func:"msg.payload = os.type(); return msg;", "libs": [{var:"os", module:"os"}]},
|
||||||
{id:"n2", type:"helper"}
|
{id:"n2", type:"helper"}
|
||||||
];
|
];
|
||||||
helper.settings({
|
RED.settings.functionExternalModules = true;
|
||||||
functionExternalModules: true
|
|
||||||
})
|
|
||||||
helper.load(functionNode, flow, function() {
|
helper.load(functionNode, flow, function() {
|
||||||
var n1 = helper.getNode("n1");
|
var n1 = helper.getNode("n1");
|
||||||
var n2 = helper.getNode("n2");
|
var n2 = helper.getNode("n2");
|
||||||
@ -1482,9 +1480,7 @@ describe('function node', function() {
|
|||||||
{id:"n1",type:"function",wires:[["n2"]],func:"msg.payload = os.type(); return msg;", "libs": [{var:"flow", module:"os"}]},
|
{id:"n1",type:"function",wires:[["n2"]],func:"msg.payload = os.type(); return msg;", "libs": [{var:"flow", module:"os"}]},
|
||||||
{id:"n2", type:"helper"}
|
{id:"n2", type:"helper"}
|
||||||
];
|
];
|
||||||
helper.settings({
|
RED.settings.functionExternalModules = true;
|
||||||
functionExternalModules: true
|
|
||||||
})
|
|
||||||
helper.load(functionNode, flow, function() {
|
helper.load(functionNode, flow, function() {
|
||||||
var n1 = helper.getNode("n1");
|
var n1 = helper.getNode("n1");
|
||||||
should.not.exist(n1);
|
should.not.exist(n1);
|
||||||
|
Loading…
Reference in New Issue
Block a user