Extra tests for html, xml, json and tail nodes

(and some consistent passing of missing payloads)
This commit is contained in:
dceejay
2015-03-24 17:43:47 +00:00
parent 72a9de058d
commit fcc6943f98
8 changed files with 140 additions and 60 deletions

View File

@@ -21,7 +21,7 @@ var helper = require("../../helper.js");
describe('XML node', function() {
before(function(done) {
helper.startServer(done);
helper.startServer(done);
});
afterEach(function() {
@@ -120,4 +120,19 @@ describe('XML node', function() {
});
});
it('should just pass through if payload is missing', function(done) {
var flow = [{id:"n1",type:"xml",wires:[["n2"]],func:"return msg;"},
{id:"n2", type:"helper"}];
helper.load(xmlNode, flow, function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
n2.on("input", function(msg) {
msg.should.have.property('topic', 'bar');
msg.should.not.have.property('payload');
done();
});
n1.receive({topic: "bar"});
});
});
});