-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from json-logic/proposal/leaf-coercion
Create leaf-coercion-proposal.json
- Loading branch information
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
[ | ||
"# These are tests from https://github.com/orgs/json-logic/discussions/2", | ||
{ | ||
"description": "Standard Max", | ||
"rule": { "max": [1, 2, 3] }, | ||
"data": {}, | ||
"result": 3 | ||
}, | ||
{ | ||
"description": "Standard Max, Single Argument Sugared", | ||
"rule": {"max": 1}, | ||
"data": {}, | ||
"result": 1 | ||
}, | ||
{ | ||
"description": "Max with Logic Chaining", | ||
"rule": { "max": {"var": "data"} }, | ||
"data": { "data": [1, 2, 3] }, | ||
"result": 3 | ||
}, | ||
{ | ||
"description": "Cat with Logic Chaining", | ||
"rule": { | ||
"cat": { | ||
"merge": [ ["Hello "], ["World", "!"] ] | ||
} | ||
}, | ||
"data": {}, | ||
"result": "Hello World!" | ||
}, | ||
{ | ||
"description": "Cat with Logic Chaining (Simple)", | ||
"rule": { "cat": {"var": "text"} }, | ||
"data": { "text": ["Hello ", "World", "!"] }, | ||
"result": "Hello World!" | ||
}, | ||
{ | ||
"rule": { | ||
"max": { | ||
"map": [ | ||
{ | ||
"filter": [ | ||
{"var": "people"}, | ||
{ | ||
"===": [ {"var": "department"}, "Engineering" ] | ||
} | ||
] | ||
}, | ||
{"var": "salary"} | ||
] | ||
} | ||
}, | ||
"data": { | ||
"people": [ | ||
{"name": "Jay Ortiz" , "salary": 100414, "department": "Engineering"}, | ||
{"name": "Louisa Hall" , "salary": 133601, "department": "Sales" }, | ||
{"name": "Kyle Carlson" , "salary": 139803, "department": "Sales" }, | ||
{"name": "Grace Ortiz" , "salary": 147068, "department": "Engineering"}, | ||
{"name": "Isabelle Harrington", "salary": 112704, "department": "Marketing" }, | ||
{"name": "Harold Moore" , "salary": 125221, "department": "Sales" }, | ||
{"name": "Clarence Schultz" , "salary": 127985, "department": "Sales" }, | ||
{"name": "Jesse Keller" , "salary": 149212, "department": "Engineering"}, | ||
{"name": "Phillip Holland" , "salary": 105888, "department": "Marketing" }, | ||
{"name": "Mason Sullivan" , "salary": 147161, "department": "Engineering"} | ||
] | ||
}, | ||
"result": 149212, | ||
"description": "Max with Logic Chaining (Complex)" | ||
} | ||
] |