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

Remove _info/type tests for subflow node tests

This commit is contained in:
Nick O'Leary 2020-05-22 21:23:55 +01:00
parent 1c94064c57
commit 82b3a97d99
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -447,117 +447,4 @@ describe('subflow', function() {
});
});
it('should access env var type of subflow instance', function(done) {
var flow = [
{id:"t0", type:"tab", label:"", disabled:false, info:""},
{id:"n1", x:10, y:10, z:"t0", type:"subflow:s1",
env: [
{name: "K", type: "str", value: "V"}
],
wires:[["n2"]]},
{id:"n2", x:10, y:10, z:"t0", type:"helper", wires:[]},
// Subflow
{id:"s1", type:"subflow", name:"Subflow", info:"",
in:[{
x:10, y:10,
wires:[ {id:"s1-n1"} ]
}],
out:[{
x:10, y:10,
wires:[ {id:"s1-n1", port:0} ]
}]
},
{id:"s1-n1", x:10, y:10, z:"s1", type:"function",
func:"msg.V = env.get('K_type'); return msg;",
wires:[]}
];
helper.load(functionNode, flow, function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
try {
msg.should.have.property("V", "str");
done();
}
catch (e) {
console.log(e);
done(e);
}
});
n1.receive({payload:"foo"});
});
});
it('should access env var info of subflow instance', function(done) {
var flow = [
{id:"t0", type:"tab", label:"", disabled:false, info:""},
{id:"n1", x:10, y:10, z:"t0", type:"subflow:s1",
env: [
{name: "K", type: "str", value: "V"}
],
wires:[["n2"]]},
{id:"n2", x:10, y:10, z:"t0", type:"helper", wires:[]},
// Subflow
{id:"s1", type:"subflow", name:"Subflow", info:"",
in:[{
x:10, y:10,
wires:[ {id:"s1-n1"} ]
}],
out:[{
x:10, y:10,
wires:[ {id:"s1-n1", port:0} ]
}],
env:[
{
name: "K", type: "str", value: "",
ui: {
hasUI: true,
icon: "icon",
labels: {
"en-US": "label"
},
type: "input",
inputTypes: {
str: true
}
}
}
]
},
{id:"s1-n1", x:10, y:10, z:"s1", type:"function",
func:"msg.V = env.get('K_info'); return msg;",
wires:[]}
];
helper.load(functionNode, flow, function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
try {
msg.should.have.property("V");
var v = msg.V;
v.should.have.property("name", "K");
v.should.have.property("value", "V");
v.should.have.property("type", "str");
v.should.have.property("ui");
var ui = v.ui;
ui.should.have.property("hasUI", true);
ui.should.have.property("icon", "icon");
ui.should.have.property("type", "input");
ui.should.have.property("labels");
var labels = ui.labels;
labels.should.have.property("en-US", "label");
ui.should.have.property("inputTypes");
var types = ui.inputTypes;
types.should.have.property("str", true);
done();
}
catch (e) {
console.log(e);
done(e);
}
});
n1.receive({payload:"foo"});
});
});
});