mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
parent
61b12f6bbe
commit
d70b7ea924
@ -1,5 +1,6 @@
|
|||||||
const flowUtil = require("./util");
|
const flowUtil = require("./util");
|
||||||
const credentials = require("../nodes/credentials");
|
const credentials = require("../nodes/credentials");
|
||||||
|
const clone = require("clone");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a group within the runtime.
|
* This class represents a group within the runtime.
|
||||||
|
@ -16,6 +16,31 @@ describe('Group', function () {
|
|||||||
group.getSetting("NR_GROUP_NAME").should.equal("g1")
|
group.getSetting("NR_GROUP_NAME").should.equal("g1")
|
||||||
group.getSetting("NR_GROUP_ID").should.equal("group1")
|
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 () {
|
it("delegates to parent if not found", async function () {
|
||||||
const group = new Group({
|
const group = new Group({
|
||||||
getSetting: v => v+v
|
getSetting: v => v+v
|
||||||
|
Loading…
x
Reference in New Issue
Block a user