From 53bfe12ac1e00afeeec0a5f5b8e0204dd13bb597 Mon Sep 17 00:00:00 2001 From: Hiroki Uchikawa <31908137+HirokiUchikawa@users.noreply.github.com> Date: Wed, 11 Oct 2017 05:37:34 +0900 Subject: [PATCH] Add test cases for switch node (#1426) --- test/nodes/core/logic/10-switch_spec.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/nodes/core/logic/10-switch_spec.js b/test/nodes/core/logic/10-switch_spec.js index 8e8868038..c910c37e4 100644 --- a/test/nodes/core/logic/10-switch_spec.js +++ b/test/nodes/core/logic/10-switch_spec.js @@ -187,6 +187,10 @@ describe('switch Node', function() { twoFieldSwitchTest("btwn", "3", "5", true, true, 4, done); }); + it('should check if payload is between given string values', function(done) { + twoFieldSwitchTest("btwn", "c", "e", true, true, "d", done); + }); + it('should check if payload is not between given values', function(done) { twoFieldSwitchTest("btwn", 3, 5, true, false, 12, done); }); @@ -489,4 +493,9 @@ describe('switch Node', function() { }); }); + it('should handle JSONata expression', function(done) { + var flow = [{id:"switchNode1",type:"switch",name:"switchNode",property:"$abs(payload)",propertyType:"jsonata",rules:[{"t":"btwn","v":"$sqrt(16)","vt":"jsonata","v2":"$sqrt(36)","v2t":"jsonata"}],checkall:true,outputs:1,wires:[["helperNode1"]]}, + {id:"helperNode1", type:"helper", wires:[]}]; + customFlowSwitchTest(flow, true, -5, done); + }); });