Updates to sentiment, exec and range to handle missing payload properties

This commit is contained in:
dceejay
2015-03-31 08:35:56 +01:00
parent 9c22a770ef
commit 78d1da5fbc
5 changed files with 74 additions and 33 deletions

View File

@@ -37,6 +37,22 @@ describe('sentiment Node', function() {
});
});
it('should pass on msg if no payload', function(done) {
var flow = [{id:"jn1",type:"sentiment",wires:[["jn2"]]},
{id:"jn2", type:"helper"}];
helper.load(sentimentNode, flow, function() {
var jn1 = helper.getNode("jn1");
var jn2 = helper.getNode("jn2");
jn2.on("input", function(msg) {
msg.should.not.have.property('sentiment');
msg.topic.should.equal("pass on");
done();
});
var testString = 'good, great, best, brilliant';
jn1.receive({topic:"pass on"});
});
});
it('should add a positive score for good words', function(done) {
var flow = [{id:"jn1",type:"sentiment",wires:[["jn2"]]},
{id:"jn2", type:"helper"}];