1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add test cases for switch node (#1426)

This commit is contained in:
Hiroki Uchikawa 2017-10-11 05:37:34 +09:00 committed by Nick O'Leary
parent 140ea683a6
commit 53bfe12ac1

View File

@ -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);
});
});