UNPKG

pimatic

Version:

A home automation server and framework for the Raspberry PI running on node.js

371 lines (363 loc) 10.2 kB
[ { "description": "array", "schema": { "type": "array" }, "tests": [ { "description": "empty array matches schema", "data": [], "valid": true }, { "description": "numeric array matches schema", "data": [1, 2, 3], "valid": true }, { "description": "string array matches schema", "data": ["a", "b", "c"], "valid": true }, { "description": "complex array matches schema", "data": ["a", 42, ["foo", "bar"], {"x": 10}], "valid": true }, { "description": "boolean is not an array", "data": true, "valid": false }, { "description": "integer is not an array", "data": 42, "valid": false }, { "description": "number is not an array", "data": 42.1, "valid": false }, { "description": "null is not an array", "data": null, "valid": false }, { "description": "object is not an array", "data": {}, "valid": false }, { "description": "string is not an array", "data": "", "valid": false } ] }, { "description": "boolean", "schema": { "type": "boolean" }, "tests": [ { "description": "boolean true matches schema", "data": true, "valid": true }, { "description": "boolean false matches schema", "data": false, "valid": true }, { "description": "array is not boolean", "data": [], "valid": false }, { "description": "integer is not boolean", "data": 42, "valid": false }, { "description": "number is not boolean", "data": 42.1, "valid": false }, { "description": "null is not boolean", "data": null, "valid": false }, { "description": "object is not boolean", "data": {}, "valid": false }, { "description": "string is not boolean", "data": "", "valid": false } ] }, { "description": "integer", "schema": { "type": "integer" }, "tests": [ { "description": "zero is an integer", "data": 0, "valid": true }, { "description": "negative number is an integer", "data": -77, "valid": true }, { "description": "value is an integer", "data": 42, "valid": true }, { "description": "number without a fraction or exponent part is an integer", "data": 42.0, "valid": true }, { "description": "array is not integer", "data": [], "valid": false }, { "description": "boolean is not integer", "data": false, "valid": false }, { "description": "non-integer number is not integer", "data": 42.1, "valid": false }, { "description": "null is not integer", "data": null, "valid": false }, { "description": "object is not integer", "data": {}, "valid": false }, { "description": "string is not integer", "data": "", "valid": false } ] }, { "description": "number", "schema": { "type": "number" }, "tests": [ { "description": "zero is a number", "data": 0, "valid": true }, { "description": "negative number is a number", "data": -77, "valid": true }, { "description": "integer is a number", "data": 42, "valid": true }, { "description": "number without a fraction or exponent part is a number", "data": 42.0, "valid": true }, { "description": "float is a number", "data": 42.1, "valid": true }, { "description": "negative float is a number", "data": -0.0001, "valid": true }, { "description": "array is not a number", "data": [], "valid": false }, { "description": "boolean is not a number", "data": false, "valid": false }, { "description": "null is not a number", "data": null, "valid": false }, { "description": "object is not a number", "data": {}, "valid": false }, { "description": "string is not a number", "data": "", "valid": false } ] }, { "description": "null", "schema": { "type": "null" }, "tests": [ { "description": "null is the only value that matches the schema", "data": null, "valid": true }, { "description": "array does not match the schema", "data": [], "valid": false }, { "description": "boolean does not match the schema", "data": false, "valid": false }, { "description": "integer does not match the schema", "data": 42, "valid": false }, { "description": "number does not match the schema", "data": 42.1, "valid": false }, { "description": "object does not match the schema", "data": {}, "valid": false }, { "description": "string does not match the schema", "data": "", "valid": false } ] }, { "description": "object", "schema": { "type": "object" }, "tests": [ { "description": "empty object matches the schema", "data": {}, "valid": true }, { "description": "complex object matches the schema", "data": {"x": 10, "y": 20, "z": "hello"}, "valid": true }, { "description": "boolean does not match the schema", "data": false, "valid": false }, { "description": "integer does not match the schema", "data": 42, "valid": false }, { "description": "number does not match the schema", "data": 42.1, "valid": false }, { "description": "null does not match the schema", "data": null, "valid": false }, { "description": "string does not match the schema", "data": "", "valid": false } ] }, { "description": "string", "schema": { "type": "string" }, "tests": [ { "description": "empty string matches the schema", "data": "", "valid": true }, { "description": "string matches the schema", "data": "hello world", "valid": true }, { "description": "array does not match the schema", "data": [], "valid": false }, { "description": "boolean does not match the schema", "data": false, "valid": false }, { "description": "integer does not match the schema", "data": 42, "valid": false }, { "description": "number does not match the schema", "data": 42.1, "valid": false }, { "description": "null does not match the schema", "data": null, "valid": false }, { "description": "object does not match the schema", "data": {}, "valid": false } ] } ]