Skip to content

Commit

Permalink
Added if/then/else sequencing tests; resolves json-schema-org#436
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsdennis committed Sep 27, 2020
1 parent d082963 commit 9a64bbb
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/draft2019-09/if-then-else.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,5 +224,35 @@
"valid": true
}
]
},
{
"description": "if appears at the end when serialized (keyword processing sequence)",
"schema": {
"then": { "const": "yes" },
"else": { "const": "other" },
"if": { "maxLength": 4 }
},
"tests": [
{
"description": "yes redirects to then and passes",
"data": "yes",
"valid": true
},
{
"description": "other redirects to else and passes",
"data": "other",
"valid": true
},
{
"description": "no redirects to then and fails",
"data": "no",
"valid": false
},
{
"description": "invalid redirects to else and fails",
"data": "invalid",
"valid": false
}
]
}
]
30 changes: 30 additions & 0 deletions tests/draft7/if-then-else.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,5 +224,35 @@
"valid": true
}
]
},
{
"description": "if appears at the end when serialized (keyword processing sequence)",
"schema": {
"then": { "const": "yes" },
"else": { "const": "other" },
"if": { "maxLength": 4 }
},
"tests": [
{
"description": "yes redirects to then and passes",
"data": "yes",
"valid": true
},
{
"description": "other redirects to else and passes",
"data": "other",
"valid": true
},
{
"description": "no redirects to then and fails",
"data": "no",
"valid": false
},
{
"description": "invalid redirects to else and fails",
"data": "invalid",
"valid": false
}
]
}
]

0 comments on commit 9a64bbb

Please sign in to comment.