From bb1b3727cbb5e98d9f74736e33566b354f3d7055 Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Sun, 23 May 2021 10:42:28 +0900 Subject: [PATCH] add test case --- test/nodes/core/function/10-switch_spec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/nodes/core/function/10-switch_spec.js b/test/nodes/core/function/10-switch_spec.js index dfcc55572..180ec9d36 100644 --- a/test/nodes/core/function/10-switch_spec.js +++ b/test/nodes/core/function/10-switch_spec.js @@ -1134,4 +1134,20 @@ describe('switch Node', function() { }); }); + + it('should handle empty rule', function(done) { + var flow = [{id:"switchNode1",type:"switch",name:"switchNode",property:"payload",rules:[],checkall:true,outputs:0,wires:[]}]; + helper.load(switchNode, flow, function() { + var n1 = helper.getNode("switchNode1"); + setTimeout(function() { + var logEvents = helper.log().args.filter(function (evt) { + return evt[0].type == "switch"; + }); + if (logEvents.length === 0) { + done(); + } + }, 150); + n1.receive({payload:1}); + }); + }); });