mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix wrong test cases
This commit is contained in:
parent
bd5e8ba961
commit
6fc863a91e
@ -343,19 +343,21 @@ describe('switch Node', function() {
|
|||||||
"checkall": "true", "outputs": "1", "wires": [["helperNode1"]], "z": "flow"},
|
"checkall": "true", "outputs": "1", "wires": [["helperNode1"]], "z": "flow"},
|
||||||
{"id": "helperNode1", "type": "helper", "wires": []}];
|
{"id": "helperNode1", "type": "helper", "wires": []}];
|
||||||
helper.load(switchNode, flow, function () {
|
helper.load(switchNode, flow, function () {
|
||||||
var switchNode1 = helper.getNode("switchNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var switchNode1 = helper.getNode("switchNode1");
|
||||||
helperNode1.on("input", function (msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function (msg) {
|
||||||
msg.payload.should.equal("value");
|
try {
|
||||||
done();
|
msg.payload.should.equal("value");
|
||||||
} catch (err) {
|
done();
|
||||||
done(err);
|
} catch (err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
switchNode1.context().flow.set("foo", "flowValue", "memory1", function (err) {
|
});
|
||||||
switchNode1.context().flow.set("bar", "flowValue", "memory1", function (err) {
|
switchNode1.context().flow.set("foo", "flowValue", "memory1", function (err) {
|
||||||
switchNode1.receive({payload: "value"});
|
switchNode1.context().flow.set("bar", "flowValue", "memory1", function (err) {
|
||||||
|
switchNode1.receive({payload: "value"});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -389,19 +391,21 @@ describe('switch Node', function() {
|
|||||||
"checkall": "true", "outputs": "1", "wires": [["helperNode1"]]},
|
"checkall": "true", "outputs": "1", "wires": [["helperNode1"]]},
|
||||||
{"id": "helperNode1", "type": "helper", "wires": []}];
|
{"id": "helperNode1", "type": "helper", "wires": []}];
|
||||||
helper.load(switchNode, flow, function () {
|
helper.load(switchNode, flow, function () {
|
||||||
var switchNode1 = helper.getNode("switchNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var switchNode1 = helper.getNode("switchNode1");
|
||||||
helperNode1.on("input", function (msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function (msg) {
|
||||||
msg.payload.should.equal("foo");
|
try {
|
||||||
done();
|
msg.payload.should.equal("foo");
|
||||||
} catch (err) {
|
done();
|
||||||
done(err);
|
} catch (err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
switchNode1.context().global.set("foo", "globalValue", "memory1", function (err) {
|
});
|
||||||
switchNode1.context().global.set("bar", "globalValue", "memory1", function (err) {
|
switchNode1.context().global.set("foo", "globalValue", "memory1", function (err) {
|
||||||
switchNode1.receive({payload: "foo"});
|
switchNode1.context().global.set("bar", "globalValue", "memory1", function (err) {
|
||||||
|
switchNode1.receive({payload: "foo"});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -790,15 +794,15 @@ describe('switch Node', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should handle persistable flow and global contexts with JSONata expression', function(done) {
|
it('should handle persistable flow and global contexts with JSONata expression', function(done) {
|
||||||
var flow = [{id:"switchNode1",type:"switch",name:"switchNode",property:"$abs($flowContext(\"payload\",\"memory\"))",propertyType:"jsonata",rules:[{"t":"btwn","v":"$flowContext(\"vt\",\"memory\")","vt":"jsonata","v2":"$globalContext(\"v2t\",\"memory\")","v2t":"jsonata"}],checkall:true,outputs:1,wires:[["helperNode1"]],z:"flow"},
|
var flow = [{id:"switchNode1",type:"switch",name:"switchNode",property:"$abs($flowContext(\"payload\",\"memory1\"))",propertyType:"jsonata",rules:[{"t":"btwn","v":"$flowContext(\"vt\",\"memory1\")","vt":"jsonata","v2":"$globalContext(\"v2t\",\"memory1\")","v2t":"jsonata"}],checkall:true,outputs:1,wires:[["helperNode1"]],z:"flow"},
|
||||||
{id:"helperNode1", type:"helper", wires:[],z:"flow"},
|
{id:"helperNode1", type:"helper", wires:[],z:"flow"},
|
||||||
{id:"flow",type:"tab"}];
|
{id:"flow",type:"tab"}];
|
||||||
helper.load(switchNode, flow, function() {
|
helper.load(switchNode, flow, function() {
|
||||||
initContext(function () {
|
initContext(function () {
|
||||||
var switchNode1 = helper.getNode("switchNode1");
|
var switchNode1 = helper.getNode("switchNode1");
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
switchNode1.context().flow.set(["payload","vt"],[-7,6],"memory",function(){
|
switchNode1.context().flow.set(["payload","vt"],[-7,6],"memory1",function(){
|
||||||
switchNode1.context().global.set("v2t",8,"memory",function(){
|
switchNode1.context().global.set("v2t",8,"memory1",function(){
|
||||||
helperNode1.on("input", function(msg) {
|
helperNode1.on("input", function(msg) {
|
||||||
try {
|
try {
|
||||||
should.equal(msg.payload,"pass");
|
should.equal(msg.payload,"pass");
|
||||||
|
@ -122,20 +122,23 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t":"set","p":"#:(memory1)::globalValue","pt":"global","to":"changed","tot":"str"}],"name":"changeNode","wires":[["helperNode1"]]},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t":"set","p":"#:(memory1)::globalValue","pt":"global","to":"changed","tot":"str"}],"name":"changeNode","wires":[["helperNode1"]]},
|
||||||
{id:"helperNode1", type:"helper", wires:[]}];
|
{id:"helperNode1", type:"helper", wires:[]}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
changeNode1.context().global.get("globalValue", "meomry", function (err, val) {
|
try {
|
||||||
val.should.equal("changed");
|
changeNode1.context().global.get("globalValue", "memory1", function (err, val) {
|
||||||
done();
|
val.should.equal("changed");
|
||||||
});
|
done();
|
||||||
} catch(err) {
|
});
|
||||||
done(err);
|
} catch(err) {
|
||||||
}
|
done(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
changeNode1.context().global.set("globalValue","changeMe","memory1", function (err) {
|
||||||
|
changeNode1.receive({payload:""});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
changeNode1.context().global.set("globalValue","changeMe","memory1");
|
|
||||||
changeNode1.receive({payload:""});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -347,18 +350,20 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"set","p":"payload","to":"#:(memory1)::flowValue","tot":"flow"}],"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"set","p":"payload","to":"#:(memory1)::flowValue","tot":"flow"}],"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
||||||
{id:"helperNode1", type:"helper", wires:[]}];
|
{id:"helperNode1", type:"helper", wires:[]}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
msg.payload.should.eql("Hello World!");
|
try {
|
||||||
done();
|
msg.payload.should.eql("Hello World!");
|
||||||
} catch(err) {
|
done();
|
||||||
done(err);
|
} catch(err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
changeNode1.context().flow.set("flowValue","Hello World!","memory1",function(err) {
|
});
|
||||||
changeNode1.receive({payload:""});
|
changeNode1.context().flow.set("flowValue","Hello World!","memory1",function(err) {
|
||||||
|
changeNode1.receive({payload:""});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -386,18 +391,20 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"set","p":"payload","to":"#:(memory1)::globalValue","tot":"global"}],"name":"changeNode","wires":[["helperNode1"]]},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"set","p":"payload","to":"#:(memory1)::globalValue","tot":"global"}],"name":"changeNode","wires":[["helperNode1"]]},
|
||||||
{id:"helperNode1", type:"helper", wires:[]}];
|
{id:"helperNode1", type:"helper", wires:[]}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
msg.payload.should.eql("Hello World!");
|
try {
|
||||||
done();
|
msg.payload.should.eql("Hello World!");
|
||||||
} catch(err) {
|
done();
|
||||||
done(err);
|
} catch(err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
changeNode1.context().global.set("globalValue","Hello World!","memory1", function (err) {
|
});
|
||||||
changeNode1.receive({payload:""});
|
changeNode1.context().global.set("globalValue","Hello World!","memory1", function (err) {
|
||||||
|
changeNode1.receive({payload:""});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -564,20 +571,18 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"set","p":"payload","to":"$flowContext(\"foo\")","tot":"jsonata"}],"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"set","p":"payload","to":"$flowContext(\"foo\")","tot":"jsonata"}],"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
||||||
{id:"helperNode1", type:"helper", wires:[],"z":"flow"},{"id":"flow","type":"tab"}];
|
{id:"helperNode1", type:"helper", wires:[],"z":"flow"},{"id":"flow","type":"tab"}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
initContext(function () {
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
changeNode1.context().flow.set("foo","bar");
|
||||||
changeNode1.context().flow.set("foo","bar");
|
helperNode1.on("input", function(msg) {
|
||||||
helperNode1.on("input", function(msg) {
|
try {
|
||||||
try {
|
msg.payload.should.eql("bar");
|
||||||
msg.payload.should.eql("bar");
|
done();
|
||||||
done();
|
} catch(err) {
|
||||||
} catch(err) {
|
done(err);
|
||||||
done(err);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
changeNode1.receive({payload:"Hello World!"});
|
|
||||||
});
|
});
|
||||||
|
changeNode1.receive({payload:"Hello World!"});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -585,20 +590,18 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"set","p":"payload","to":"$globalContext(\"foo\")","tot":"jsonata"}],"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"set","p":"payload","to":"$globalContext(\"foo\")","tot":"jsonata"}],"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
||||||
{id:"helperNode1", type:"helper", wires:[],"z":"flow"},{"id":"flow","type":"tab"}];
|
{id:"helperNode1", type:"helper", wires:[],"z":"flow"},{"id":"flow","type":"tab"}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
initContext(function () {
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
changeNode1.context().global.set("foo","bar");
|
||||||
changeNode1.context().global.set("foo","bar");
|
helperNode1.on("input", function(msg) {
|
||||||
helperNode1.on("input", function(msg) {
|
try {
|
||||||
try {
|
msg.payload.should.eql("bar");
|
||||||
msg.payload.should.eql("bar");
|
done();
|
||||||
done();
|
} catch(err) {
|
||||||
} catch(err) {
|
done(err);
|
||||||
done(err);
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
changeNode1.receive({payload:"Hello World!"});
|
|
||||||
});
|
});
|
||||||
|
changeNode1.receive({payload:"Hello World!"});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -899,18 +902,20 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"change","p":"payload","from":"#:(memory1)::topic","to":"123","fromt":"flow","tot":"str"}],"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"change","p":"payload","from":"#:(memory1)::topic","to":"123","fromt":"flow","tot":"str"}],"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
||||||
{id:"helperNode1", type:"helper", wires:[]}];
|
{id:"helperNode1", type:"helper", wires:[]}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
msg.payload.should.equal("abc123abc");
|
try {
|
||||||
done();
|
msg.payload.should.equal("abc123abc");
|
||||||
} catch(err) {
|
done();
|
||||||
done(err);
|
} catch(err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
changeNode1.context().flow.set("topic","ABC","memory1", function (err) {
|
});
|
||||||
changeNode1.receive({payload:"abcABCabc"});
|
changeNode1.context().flow.set("topic","ABC","memory1", function (err) {
|
||||||
|
changeNode1.receive({payload:"abcABCabc"});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -938,18 +943,20 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"change","p":"payload","from":"#:(memory1)::topic","to":"123","fromt":"global","tot":"str"}],"name":"changeNode","wires":[["helperNode1"]]},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"change","p":"payload","from":"#:(memory1)::topic","to":"123","fromt":"global","tot":"str"}],"name":"changeNode","wires":[["helperNode1"]]},
|
||||||
{id:"helperNode1", type:"helper", wires:[]}];
|
{id:"helperNode1", type:"helper", wires:[]}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
msg.payload.should.equal("abc123abc");
|
try {
|
||||||
done();
|
msg.payload.should.equal("abc123abc");
|
||||||
} catch(err) {
|
done();
|
||||||
done(err);
|
} catch(err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
changeNode1.context().global.set("topic","ABC","memory1",function (err) {
|
});
|
||||||
changeNode1.receive({payload:"abcABCabc"});
|
changeNode1.context().global.set("topic","ABC","memory1",function (err) {
|
||||||
|
changeNode1.receive({payload:"abcABCabc"});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -977,18 +984,20 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"change","p":"payload","from":"#:(memory1)::topic","to":"ABC","fromt":"global","tot":"str"}],"name":"changeNode","wires":[["helperNode1"]]},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{"t":"change","p":"payload","from":"#:(memory1)::topic","to":"ABC","fromt":"global","tot":"str"}],"name":"changeNode","wires":[["helperNode1"]]},
|
||||||
{id:"helperNode1", type:"helper", wires:[]}];
|
{id:"helperNode1", type:"helper", wires:[]}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
msg.payload.should.equal("ABC");
|
try {
|
||||||
done();
|
msg.payload.should.equal("ABC");
|
||||||
} catch(err) {
|
done();
|
||||||
done(err);
|
} catch(err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
changeNode1.context().global.set("topic",123,"memory1",function (err) {
|
});
|
||||||
changeNode1.receive({payload:123});
|
changeNode1.context().global.set("topic",123,"memory1",function (err) {
|
||||||
|
changeNode1.receive({payload:123});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1088,20 +1097,22 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "change", "p": "#:(memory1)::payload", "pt": "global", "from": "Hello", "fromt": "str", "to": "Goodbye", "tot": "str" }],"reg":false,"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "change", "p": "#:(memory1)::payload", "pt": "global", "from": "Hello", "fromt": "str", "to": "Goodbye", "tot": "str" }],"reg":false,"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
||||||
{id:"helperNode1", type:"helper", wires:[],"z":"flow"}];
|
{id:"helperNode1", type:"helper", wires:[],"z":"flow"}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
helperNode1.context().global.get("payload","memory1", function (err, val) {
|
try {
|
||||||
val.should.equal("Goodbye World!");
|
helperNode1.context().global.get("payload","memory1", function (err, val) {
|
||||||
done();
|
val.should.equal("Goodbye World!");
|
||||||
});
|
done();
|
||||||
} catch(err) {
|
});
|
||||||
done(err);
|
} catch(err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
changeNode1.context().global.set("payload","Hello World!","memory1",function (err) {
|
});
|
||||||
changeNode1.receive({payload:""});
|
changeNode1.context().global.set("payload","Hello World!","memory1",function (err) {
|
||||||
|
changeNode1.receive({payload:""});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1130,21 +1141,23 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "change", "p": "#:(memory1)::payload", "pt": "flow", "from": "123", "fromt": "str", "to": "456", "tot": "num" }],"reg":false,"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "change", "p": "#:(memory1)::payload", "pt": "flow", "from": "123", "fromt": "str", "to": "456", "tot": "num" }],"reg":false,"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
||||||
{id:"helperNode1", type:"helper", wires:[],"z":"flow"}];
|
{id:"helperNode1", type:"helper", wires:[],"z":"flow"}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
helperNode1.context().flow.get("payload","memory1",function (err, val) {
|
try {
|
||||||
val.should.equal("Change456Me");
|
helperNode1.context().flow.get("payload","memory1",function (err, val) {
|
||||||
val.should.be.a.String();
|
val.should.equal("Change456Me");
|
||||||
done();
|
val.should.be.a.String();
|
||||||
});
|
done();
|
||||||
} catch(err) {
|
});
|
||||||
done(err);
|
} catch(err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
changeNode1.context().flow.set("payload","Change123Me","memory1",function (err) {
|
});
|
||||||
changeNode1.receive({payload:""});
|
changeNode1.context().flow.set("payload","Change123Me","memory1",function (err) {
|
||||||
|
changeNode1.receive({payload:""});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1173,19 +1186,23 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "change", "p": "#:(memory1)::payload", "pt": "flow", "from": "123", "fromt": "str", "to": "456", "tot": "num" }],"reg":false,"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "change", "p": "#:(memory1)::payload", "pt": "flow", "from": "123", "fromt": "str", "to": "456", "tot": "num" }],"reg":false,"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
||||||
{id:"helperNode1", type:"helper", wires:[],"z":"flow"}];
|
{id:"helperNode1", type:"helper", wires:[],"z":"flow"}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
helperNode1.context().flow.get("payload").should.equal(456);
|
try {
|
||||||
helperNode1.context().flow.get("payload").should.be.a.Number();
|
helperNode1.context().flow.get("payload","memory1",function (err, val) {
|
||||||
done();
|
val.should.be.a.Number();
|
||||||
} catch(err) {
|
val.should.equal(456);
|
||||||
done(err);
|
done();
|
||||||
}
|
});
|
||||||
});
|
} catch(err) {
|
||||||
changeNode1.context().flow.set("payload","123","memory1",function (err) {
|
done(err);
|
||||||
changeNode1.receive({payload:""});
|
}
|
||||||
|
});
|
||||||
|
changeNode1.context().flow.set("payload","123","memory1",function (err) {
|
||||||
|
changeNode1.receive({payload:""});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1213,20 +1230,22 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "change", "p": "#:(memory1)::payload", "pt": "flow", "from": "123", "fromt": "num", "to": "abc", "tot": "str" }],"reg":false,"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "change", "p": "#:(memory1)::payload", "pt": "flow", "from": "123", "fromt": "num", "to": "abc", "tot": "str" }],"reg":false,"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
||||||
{id:"helperNode1", type:"helper", wires:[],"z":"flow"}];
|
{id:"helperNode1", type:"helper", wires:[],"z":"flow"}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
helperNode1.context().flow.get("payload","memory1",function (err, val) {
|
try {
|
||||||
val.should.equal("abc");
|
helperNode1.context().flow.get("payload","memory1",function (err, val) {
|
||||||
done();
|
val.should.equal("abc");
|
||||||
});
|
done();
|
||||||
} catch(err) {
|
});
|
||||||
done(err);
|
} catch(err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
changeNode1.context().flow.set("payload",123,"memory1",function (err) {
|
});
|
||||||
changeNode1.receive({payload:""});
|
changeNode1.context().flow.set("payload",123,"memory1",function (err) {
|
||||||
|
changeNode1.receive({payload:""});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1254,20 +1273,22 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "change", "p": "#:(memory1)::payload", "pt": "flow", "from": "true", "fromt": "bool", "to": "abc", "tot": "str" }],"reg":false,"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "change", "p": "#:(memory1)::payload", "pt": "flow", "from": "true", "fromt": "bool", "to": "abc", "tot": "str" }],"reg":false,"name":"changeNode","wires":[["helperNode1"]],"z":"flow"},
|
||||||
{id:"helperNode1", type:"helper", wires:[],"z":"flow"}];
|
{id:"helperNode1", type:"helper", wires:[],"z":"flow"}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
helperNode1.context().flow.get("payload","memory1",function (err, val) {
|
try {
|
||||||
val.should.equal("abc");
|
helperNode1.context().flow.get("payload","memory1",function (err, val) {
|
||||||
done();
|
val.should.equal("abc");
|
||||||
});
|
done();
|
||||||
} catch(err) {
|
});
|
||||||
done(err);
|
} catch(err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
changeNode1.context().flow.set("payload",true,function (err) {
|
});
|
||||||
changeNode1.receive({payload:""});
|
changeNode1.context().flow.set("payload",true,"memory1",function (err) {
|
||||||
|
changeNode1.receive({payload:""});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1342,20 +1363,22 @@ describe('change Node', function() {
|
|||||||
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "delete", "p": "#:(memory1)::globalValue", "pt": "global"}],"name":"changeNode","wires":[["helperNode1"]]},
|
var flow = [{"id":"changeNode1","type":"change",rules:[{ "t": "delete", "p": "#:(memory1)::globalValue", "pt": "global"}],"name":"changeNode","wires":[["helperNode1"]]},
|
||||||
{id:"helperNode1", type:"helper", wires:[]}];
|
{id:"helperNode1", type:"helper", wires:[]}];
|
||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
initContext(function () {
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
helperNode1.on("input", function(msg) {
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
try {
|
helperNode1.on("input", function(msg) {
|
||||||
changeNode1.context().global.get("globalValue","memory1",function(err,val) {
|
try {
|
||||||
should.equal(undefined);
|
changeNode1.context().global.get("globalValue","memory1",function(err,val) {
|
||||||
done();
|
should.equal(undefined);
|
||||||
});
|
done();
|
||||||
} catch(err) {
|
});
|
||||||
done(err);
|
} catch(err) {
|
||||||
}
|
done(err);
|
||||||
});
|
}
|
||||||
changeNode1.context().global.set("globalValue","Hello World!","memory1",function (err) {
|
});
|
||||||
changeNode1.receive({payload:""});
|
changeNode1.context().global.set("globalValue","Hello World!","memory1",function (err) {
|
||||||
|
changeNode1.receive({payload:""});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user