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

@@ -66,4 +66,23 @@ describe('random node', function() {
});
});
it('should output an integer between -3 and 3 on chosen property - foo', function(done) {
var flow = [{"id":"n1", "type":"random", property:"foo", low:-3, high:3, inte:true, wires:[["n2"]] },
{id:"n2", type:"helper"} ];
helper.load(testNode, flow, function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
var c = 0;
n2.on("input", function(msg) {
if (c === 0) {
msg.should.have.a.property("foo");
msg.foo.should.be.approximately(0,3);
msg.foo.toString().indexOf(".").should.equal(-1);
done();
}
});
n1.emit("input", {payload:"a"});
});
});
});