From 0566a2d9b1e011f6bd1848e6929f7b656f2ae54c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 2 Mar 2021 00:12:41 +0000 Subject: [PATCH] Fix function node tests use of RED.settings --- test/nodes/core/function/10-function_spec.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/test/nodes/core/function/10-function_spec.js b/test/nodes/core/function/10-function_spec.js index 59efd9db4..609fac1d3 100644 --- a/test/nodes/core/function/10-function_spec.js +++ b/test/nodes/core/function/10-function_spec.js @@ -18,7 +18,7 @@ var should = require("should"); 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 helper = require("node-red-node-test-helper"); - +var RED = require("nr-test-utils").require("node-red/lib/red"); describe('function node', function() { before(function(done) { @@ -1415,7 +1415,9 @@ describe('function node', function() { }); describe('externalModules', function() { - + afterEach(function() { + delete RED.settings.functionExternalModules; + }) it('should fail if using OS module without functionExternalModules set to true', function(done) { var flow = [ {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:"n2", type:"helper"} ]; - helper.settings({ - functionExternalModules: true - }) + RED.settings.functionExternalModules = true; helper.load(functionNode, flow, function() { var n1 = helper.getNode("n1"); 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:"n2", type:"helper"} ]; - helper.settings({ - functionExternalModules: true - }) + RED.settings.functionExternalModules = true; helper.load(functionNode, flow, function() { var n1 = helper.getNode("n1"); 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:"n2", type:"helper"} ]; - helper.settings({ - functionExternalModules: true - }) + RED.settings.functionExternalModules = true; helper.load(functionNode, flow, function() { var n1 = helper.getNode("n1"); should.not.exist(n1);