Fix clone of group env var properties

Closes #4751
This commit is contained in:
Nick O'Leary 2024-06-10 16:15:06 +01:00
parent 61b12f6bbe
commit d70b7ea924
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 26 additions and 0 deletions

View File

@ -1,5 +1,6 @@
const flowUtil = require("./util");
const credentials = require("../nodes/credentials");
const clone = require("clone");
/**
* This class represents a group within the runtime.

View File

@ -16,6 +16,31 @@ describe('Group', function () {
group.getSetting("NR_GROUP_NAME").should.equal("g1")
group.getSetting("NR_GROUP_ID").should.equal("group1")
})
it("returns cloned env var property", async function () {
const group = new Group({
getSetting: v => v+v
}, {
name: "g1",
id: "group1",
env: [
{
name: 'jsonEnvVar',
type: 'json',
value: '{"a":1}'
}
]
})
await group.start()
const result = group.getSetting('jsonEnvVar')
result.should.have.property('a', 1)
result.a = 2
result.b = 'hello'
const result2 = group.getSetting('jsonEnvVar')
result2.should.have.property('a', 1)
result2.should.not.have.property('b')
})
it("delegates to parent if not found", async function () {
const group = new Group({
getSetting: v => v+v