Support output editting of DEBUG node using JSONata

This commit is contained in:
Hiroyasu Nishiyama
2018-12-01 18:03:04 +01:00
parent 2060af8a92
commit 3c4f4d27d6
7 changed files with 118 additions and 25 deletions

View File

@@ -356,6 +356,38 @@ describe('debug node', function() {
});
});
it('should publish payload with edit', function(done) {
var flow = [{id:"n1", type:"debug", name:"Debug",
editType: "jsonata", edit: '"<" & $ & ">"'}];
helper.load(debugNode, flow, function() {
var n1 = helper.getNode("n1");
websocket_test(function() {
n1.emit("input", {payload:"test"});
}, function(msg) {
JSON.parse(msg).should.eql([{
topic:"debug",data:{id:"n1",name:"Debug",msg:"<test>",
format:"string[6]",property:"payload"}
}]);
}, done);
});
});
it('should publish complete message with edit', function(done) {
var flow = [{id:"n1", type:"debug", name:"Debug", complete: "true",
editType: "jsonata", edit: '"<" & payload & ">"'}];
helper.load(debugNode, flow, function() {
var n1 = helper.getNode("n1");
websocket_test(function() {
n1.emit("input", {payload:"test"});
}, function(msg) {
JSON.parse(msg).should.eql([{
topic:"debug",data:{id:"n1",name:"Debug",msg:"<test>",
format:"string[6]"}
}]);
}, done);
});
});
it('should truncate a long message', function(done) {
var flow = [{id:"n1", type:"debug" }];
helper.load(debugNode, flow, function() {