From 95cc8ea80de2c531704989f93aded0a14561caf6 Mon Sep 17 00:00:00 2001 From: dxdc Date: Thu, 28 May 2020 00:48:11 -0500 Subject: [PATCH] Add missing unit test for accesses undefined environment variable from an expression --- test/unit/@node-red/util/lib/util_spec.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/unit/@node-red/util/lib/util_spec.js b/test/unit/@node-red/util/lib/util_spec.js index 653342777d..4855a3cd27 100644 --- a/test/unit/@node-red/util/lib/util_spec.js +++ b/test/unit/@node-red/util/lib/util_spec.js @@ -499,6 +499,11 @@ describe("@node-red/util/util", function() { var result = util.evaluateJSONataExpression(expr,{payload:"hello"}); result.should.eql("bar"); }); + it('accesses undefined environment variable from an expression', function() { + var expr = util.prepareJSONataExpression('$env("UTIL_ENV")',{}); + var result = util.evaluateJSONataExpression(expr,{}); + result.should.eql(''); + }); it('accesses environment variable from an expression', function() { process.env.UTIL_ENV = 'foo'; var expr = util.prepareJSONataExpression('$env("UTIL_ENV")',{});