pimatic
Version:
A home automation server and framework for the Raspberry PI running on node.js
125 lines (117 loc) • 3.19 kB
JSON
[
{
"description": "maxLength",
"schema": {
"type": "string",
"maxLength": 10
},
"tests": [
{
"description": "empty string matches schema",
"data": "",
"valid": true
},
{
"description": "short string matches schema",
"data": "hello",
"valid": true
},
{
"description": "max length string matches schema",
"data": "0123456789",
"valid": true
},
{
"description": "over-length string does not match schema",
"data": "hello, world!",
"valid": false
}
]
},
{
"description": "minLength",
"schema": {
"type": "string",
"minLength": 10
},
"tests": [
{
"description": "long string matches schema",
"data": "hello, world!",
"valid": true
},
{
"description": "min-length string matches schema",
"data": "0123456789",
"valid": true
},
{
"description": "empty string does not match schema",
"data": "",
"valid": false
},
{
"description": "short string does not match schema",
"data": "hello",
"valid": false
}
]
},
{
"description": "pattern (non-anchored regex)",
"schema": {
"type": "string",
"pattern": "hello"
},
"tests": [
{
"description": "string matches schema",
"data": "I said hello to her.",
"valid": true
},
{
"description": "string does not match schema",
"data": "Hello, World",
"valid": false
}
]
},
{
"description": "pattern (anchored regex)",
"schema": {
"type": "string",
"pattern": "^hello"
},
"tests": [
{
"description": "string matches schema",
"data": "hello, world",
"valid": true
},
{
"description": "string does not match schema",
"data": "I said hello to her.",
"valid": false
}
]
},
{
"description": "pattern (comples regex)",
"schema": {
"type": "string",
"pattern": "^You owe \\$\\d+(\\.\\d+)?\\.$"
},
"tests": [
{
"description": "string matches schema",
"data": "You owe $17.69.",
"valid": true
},
{
"description": "string does not match schema",
"data": "You owe $0.nothing.",
"valid": false
}
]
}
]