Skip to content

Commit

Permalink
Add test cases for switch node (#1426)
Browse files Browse the repository at this point in the history
  • Loading branch information
HirokiUchikawa authored and knolleary committed Oct 10, 2017
1 parent 140ea68 commit 53bfe12
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/nodes/core/logic/10-switch_spec.js
Expand Up @@ -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);
});
Expand Down Expand Up @@ -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);
});
});

0 comments on commit 53bfe12

Please sign in to comment.