From 2c11addcdb5055e0f568d1b639492a930739561f Mon Sep 17 00:00:00 2001 From: Abhishek Pai Date: Wed, 18 Sep 2024 16:48:47 +0200 Subject: [PATCH] Unit tests for js engine prefix --- .../org/lsc/utils/ScriptingEvaluatorTest.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/test/java/org/lsc/utils/ScriptingEvaluatorTest.java b/src/test/java/org/lsc/utils/ScriptingEvaluatorTest.java index 9345397b..96d95207 100644 --- a/src/test/java/org/lsc/utils/ScriptingEvaluatorTest.java +++ b/src/test/java/org/lsc/utils/ScriptingEvaluatorTest.java @@ -42,4 +42,39 @@ public void testBoolean() throws LscServiceException { boolean booleanOutput = ScriptingEvaluator.evalToBoolean(task, expression, new HashMap<>()); assertTrue(booleanOutput); } + + @Test + public void testJSPrefix1() throws LscServiceException { + String expression = "\njs:true"; + boolean booleanOutput = ScriptingEvaluator.evalToBoolean(task, expression, new HashMap<>()); + assertTrue(booleanOutput); + } + + @Test + public void testJSPrefix2() throws LscServiceException { + String expression = "\njs:\ntrue"; + boolean booleanOutput = ScriptingEvaluator.evalToBoolean(task, expression, new HashMap<>()); + assertTrue(booleanOutput); + } + + @Test + public void testJSPrefix3() throws LscServiceException { + String expression = "\njs:test=\"js\""; + String stringOutput = ScriptingEvaluator.evalToString(task, expression, new HashMap<>()); + assertEquals("js", stringOutput); + } + + @Test + public void testJSPrefix4() throws LscServiceException { + String expression = "\njs:\ntest=\"js\""; + String stringOutput = ScriptingEvaluator.evalToString(task, expression, new HashMap<>()); + assertEquals("js", stringOutput); + } + + @Test + public void testJSPrefix5() throws LscServiceException { + String expression = "\n\njs:\n\ntest=\"js\""; + String stringOutput = ScriptingEvaluator.evalToString(task, expression, new HashMap<>()); + assertEquals("js", stringOutput); + } } \ No newline at end of file