diff options
Diffstat (limited to 'json/tests/draft-future/minContains.json')
-rw-r--r-- | json/tests/draft-future/minContains.json | 172 |
1 files changed, 172 insertions, 0 deletions
diff --git a/json/tests/draft-future/minContains.json b/json/tests/draft-future/minContains.json new file mode 100644 index 0000000..f9c03cb --- /dev/null +++ b/json/tests/draft-future/minContains.json @@ -0,0 +1,172 @@ +[ + { + "description": "minContains without contains is ignored", + "schema": { + "minContains": 1 + }, + "tests": [ + { + "description": "one item valid against lone minContains", + "data": [1], + "valid": true + }, + { + "description": "zero items still valid against lone minContains", + "data": [], + "valid": true + } + ] + }, + { + "description": "minContains=1 with contains", + "schema": { + "contains": { "const": 1 }, + "minContains": 1 + }, + "tests": [ + { + "description": "empty data", + "data": [], + "valid": false + }, + { + "description": "no elements match", + "data": [2], + "valid": false + }, + { + "description": "single element matches, valid minContains", + "data": [1], + "valid": true + }, + { + "description": "some elements match, valid minContains", + "data": [1, 2], + "valid": true + }, + { + "description": "all elements match, valid minContains", + "data": [1, 1], + "valid": true + } + ] + }, + { + "description": "minContains=2 with contains", + "schema": { + "contains": { "const": 1 }, + "minContains": 2 + }, + "tests": [ + { + "description": "empty data", + "data": [], + "valid": false + }, + { + "description": "all elements match, invalid minContains", + "data": [1], + "valid": false + }, + { + "description": "some elements match, invalid minContains", + "data": [1, 2], + "valid": false + }, + { + "description": "all elements match, valid minContains (exactly as needed)", + "data": [1, 1], + "valid": true + }, + { + "description": "all elements match, valid minContains (more than needed)", + "data": [1, 1, 1], + "valid": true + }, + { + "description": "some elements match, valid minContains", + "data": [1, 2, 1], + "valid": true + } + ] + }, + { + "description": "maxContains = minContains", + "schema": { + "contains": { "const": 1 }, + "maxContains": 2, + "minContains": 2 + }, + "tests": [ + { + "description": "empty data", + "data": [], + "valid": false + }, + { + "description": "all elements match, invalid minContains", + "data": [1], + "valid": false + }, + { + "description": "all elements match, invalid maxContains", + "data": [1, 1, 1], + "valid": false + }, + { + "description": "all elements match, valid maxContains and minContains", + "data": [1, 1], + "valid": true + } + ] + }, + { + "description": "maxContains < minContains", + "schema": { + "contains": { "const": 1 }, + "maxContains": 1, + "minContains": 3 + }, + "tests": [ + { + "description": "empty data", + "data": [], + "valid": false + }, + { + "description": "invalid minContains", + "data": [1], + "valid": false + }, + { + "description": "invalid maxContains", + "data": [1, 1, 1], + "valid": false + }, + { + "description": "invalid maxContains and minContains", + "data": [1, 1], + "valid": false + } + ] + }, + { + "description": "minContains = 0", + "schema": { + "contains": { "const": 1 }, + "minContains": 0 + }, + "tests": [ + { + "description": "empty data", + "data": [], + "valid": true + }, + { + "description": "minContains = 0 makes contains always pass", + "data": [2], + "valid": true + } + ] + } +] |