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

Test Node send for req/res behaviour.

This commit is contained in:
Mark Hindess 2014-07-30 10:28:25 +01:00
parent 1ce4765ed8
commit d7b3e86096

View File

@ -204,6 +204,26 @@ describe('Node', function() {
n1.send(messages); n1.send(messages);
}); });
it('emits messages without cloning req or res', function(done) {
var n1 = new RedNode({id:'n1',type:'abc',wires:[['n2']]});
var n2 = new RedNode({id:'n2',type:'abc'});
var req = {};
var res = {};
var cloned = {};
var message = {payload: "foo", cloned: cloned, req: req, res: res};
n2.on('input',function(msg) {
should.deepEqual(msg, message);
msg.cloned.should.not.be.exactly(message.cloned);
msg.req.should.be.exactly(message.req);
msg.res.should.be.exactly(message.res);
done();
});
n1.send(message);
});
}); });
describe('#log', function() { describe('#log', function() {