From 3ca7c41999f4a537f91353ea3332a0bf97d24149 Mon Sep 17 00:00:00 2001 From: Greg Dennis Date: Mon, 28 Sep 2020 10:44:21 +1300 Subject: [PATCH] Added if/then/else sequencing tests; resolves #436 --- tests/draft2019-09/if-then-else.json | 32 +++++++++++++++++++++++++++- tests/draft7/if-then-else.json | 30 ++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/tests/draft2019-09/if-then-else.json b/tests/draft2019-09/if-then-else.json index e0b873e4..f568c082 100644 --- a/tests/draft2019-09/if-then-else.json +++ b/tests/draft2019-09/if-then-else.json @@ -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 + } + ] + } ] diff --git a/tests/draft7/if-then-else.json b/tests/draft7/if-then-else.json index e0b873e4..284e9191 100644 --- a/tests/draft7/if-then-else.json +++ b/tests/draft7/if-then-else.json @@ -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 + } + ] } ]