Skip to content

Commit

Permalink
Merge pull request #8 from json-logic/proposal/leaf-coercion
Browse files Browse the repository at this point in the history
Create leaf-coercion-proposal.json
  • Loading branch information
codetiger authored Jan 16, 2025
2 parents f9e01c6 + aa67fa9 commit 64b20f7
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions tests/leaf-coercion-proposal.json
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)"
}
]

0 comments on commit 64b20f7

Please sign in to comment.