add msg.property option to rbe, randon, smooth and base64 nodes

This commit is contained in:
Dave Conway-Jones
2018-01-30 21:42:14 +00:00
parent 4ed7ab590d
commit be79b6a1c6
17 changed files with 527 additions and 565 deletions

View File

@@ -39,6 +39,20 @@ describe('base64 node', function() {
});
});
it('should convert a Buffer to base64 using another property - foo', function(done) {
var flow = [{id:"n1", type:"base64", property:"foo", wires:[["n2"]] },
{id:"n2", type:"helper"} ];
helper.load(testNode, flow, function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.a.property("foo","QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo=");
done();
});
n1.emit("input", {foo: Buffer.from("ABCDEFGHIJKLMNOPQRSTUVWXYZ")});
});
});
it('should convert base64 to a Buffer', function(done) {
var flow = [{"id":"n1", "type":"base64", wires:[["n2"]] },
{id:"n2", type:"helper"} ];
@@ -54,6 +68,21 @@ describe('base64 node', function() {
});
});
it('should convert base64 to a Buffer using another property - foo', function(done) {
var flow = [{id:"n1", type:"base64", property:"foo", wires:[["n2"]] },
{id:"n2", type:"helper"} ];
helper.load(testNode, flow, function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.a.property("foo");
msg.foo.toString().should.equal("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
done();
});
n1.emit("input", {foo:"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo="});
});
});
it('should try to encode a non base64 string', function(done) {
var flow = [{"id":"n1", "type":"base64", wires:[["n2"]] },
{id:"n2", type:"helper"} ];