mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
add msg.property option to rbe, randon, smooth and base64 nodes
This commit is contained in:
@@ -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"} ];
|
||||
|
Reference in New Issue
Block a user