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

Add missing unit test for accesses undefined environment variable from an expression

This commit is contained in:
dxdc 2020-05-28 00:48:11 -05:00 committed by GitHub
parent 18f8dde712
commit 95cc8ea80d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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")',{});