Skip to content

Commit

Permalink
IT test
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Kwok <[email protected]>
  • Loading branch information
andy-k-improving committed Jan 28, 2025
1 parent be39d90 commit 32503ea
Showing 1 changed file with 5 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,21 @@ public void test_json_set() throws IOException {
result =
executeQuery(
String.format(
"source=%s | eval updated=json_set(json_string, \"$.c.innerProperty\", \"test_value\" | fields"
"source=%s | eval updated=json_set(json_string, \\\"$.c.innerProperty\\\", \\\"test_value\\\") | fields"
+ " test_name, updated",
TEST_INDEX_JSON_TEST));
verifySchema(result,
schema("test_name", null, "string"),
schema("updated", null, "undefined"));
verifyDataRows(
result,
rows(
"json nested object",
new JSONObject(Map.of("a", "1",
"b", Map.of("c", "3"),
"d", List.of(1, 2, 3),
"c", Map.of("innerProperty", "test_value")))),
rows("json object", new JSONObject(Map.of(
"a", "1",
"b", "2",
"c", Map.of("innerProperty", "test_value")))),
rows("json nested object",
"{\"a\":\"1\",\"b\":{\"c\":\"3\"},\"d\":[1,2,3],\"c\":{\"innerProperty\":\"test_value\"}}"),
rows("json object", "{\"a\":\"1\",\"b\":\"2\",\"c\":{\"innerProperty\":\"test_value\"}}"),
rows("json array", null),
rows("json scalar string", null),
rows("json empty string", null),
rows("json invalid string", null),
rows("json invalid object", null),
rows("json null", null));
}
}

0 comments on commit 32503ea

Please sign in to comment.