Skip to content

Commit

Permalink
Merge pull request #2109 from joelpramos/issue-2009-unit-test
Browse files Browse the repository at this point in the history
unit test for for comment in #2009
  • Loading branch information
ptrthomas authored Aug 26, 2022
2 parents da1c1f8 + 37b48ad commit d9daf2c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.intuit.karate.core;

import com.intuit.karate.TestUtils;
import com.intuit.karate.StringUtils;
import com.intuit.karate.Json;
import com.intuit.karate.Match;
import com.intuit.karate.StringUtils;
import com.intuit.karate.TestUtils;
import com.intuit.karate.graal.JsValue;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.junit.jupiter.api.Assertions.*;

/**
*
* @author pthomas3
*/
public class ScenarioEngineTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,12 @@ void testMergeAndAppend() {
void testJsonPath() {
run(
"def foo = { a: 1, b: { a: 2 } }",
"def res1 = karate.jsonPath(foo, '$..a')"
"def res1 = karate.jsonPath(foo, '$..a')",
"def arr = [ {'id': 1, 'name': 'test', 'age': 10}, {'id': 2, 'name': 'test2', 'age': 20} ]",
"def res2 = karate.jsonPath(arr, '$.[?(@.id == 1)].name')[0]"
);
matchVar("res1", "[1, 2]");
matchVar("res2", "test");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Feature:
Scenario:
* def result = karate.call('classpath:com/intuit/karate/core/jscall/dummy.feature')
* utils.sayHello()
* utils.reuseExistingFunction()
* karate.call('js-called.feature')
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ Scenario: called scenario
* karate.call(true, 'dummy.feature')
* utils.sayHello()
* call read('dummy.feature')
* utils.sayHello()
* utils.sayHello()
* utils.reuseExistingFunction()
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ Feature:

Scenario:
* def sayHello = function() { return 'hello world!' }
* def reuseExistingFunction =
"""
function() {
return sayHello();
}
"""

0 comments on commit d9daf2c

Please sign in to comment.