Files
jspg/fixtures/maximum.json

134 lines
2.9 KiB
JSON

[
{
"description": "maximum validation",
"database": {
"types": [
{
"name": "maximum_0_0",
"schemas": {
"maximum_0_0": {
"maximum": 3
}
}
}
]
},
"tests": [
{
"description": "below the maximum is valid",
"data": 2.6,
"schema_id": "maximum_0_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "boundary point is valid",
"data": 3,
"schema_id": "maximum_0_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "above the maximum is invalid",
"data": 3.5,
"schema_id": "maximum_0_0",
"action": "validate",
"expect": {
"success": false,
"errors": [
{
"code": "MAXIMUM_VIOLATED",
"values": {
"value": "3.5",
"limit": "3"
},
"details": {
"path": "",
"schema": "maximum_0_0"
}
}
]
}
},
{
"description": "ignores non-numbers",
"data": "x",
"schema_id": "maximum_0_0",
"action": "validate",
"expect": {
"success": true
}
}
]
},
{
"description": "maximum validation with unsigned integer",
"database": {
"types": [
{
"name": "maximum_1_0",
"schemas": {
"maximum_1_0": {
"maximum": 300
}
}
}
]
},
"tests": [
{
"description": "below the maximum is invalid",
"data": 299.97,
"schema_id": "maximum_1_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "boundary point integer is valid",
"data": 300,
"schema_id": "maximum_1_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "boundary point float is valid",
"data": 300,
"schema_id": "maximum_1_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "above the maximum is invalid",
"data": 300.5,
"schema_id": "maximum_1_0",
"action": "validate",
"expect": {
"success": false,
"errors": [
{
"code": "MAXIMUM_VIOLATED",
"values": {
"value": "300.5",
"limit": "300"
},
"details": {
"path": "",
"schema": "maximum_1_0"
}
}
]
}
}
]
}
]