Files
jspg/fixtures/maxLength.json

125 lines
2.6 KiB
JSON

[
{
"description": "maxLength validation",
"database": {
"types": [
{
"name": "maxLength_0_0",
"schemas": {
"maxLength_0_0": {
"maxLength": 2
}
}
}
]
},
"tests": [
{
"description": "shorter is valid",
"data": "f",
"schema_id": "maxLength_0_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "exact length is valid",
"data": "fo",
"schema_id": "maxLength_0_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "too long is invalid",
"data": "foo",
"schema_id": "maxLength_0_0",
"action": "validate",
"expect": {
"success": false,
"errors": [
{
"code": "MAX_LENGTH_VIOLATED",
"values": {
"count": "3",
"limit": "2"
},
"details": {
"path": "",
"schema": "maxLength_0_0"
}
}
]
}
},
{
"description": "ignores non-strings",
"data": 100,
"schema_id": "maxLength_0_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "two graphemes is long enough",
"data": "💩💩",
"schema_id": "maxLength_0_0",
"action": "validate",
"expect": {
"success": true
}
}
]
},
{
"description": "maxLength validation with a decimal",
"database": {
"types": [
{
"name": "maxLength_1_0",
"schemas": {
"maxLength_1_0": {
"maxLength": 2
}
}
}
]
},
"tests": [
{
"description": "shorter is valid",
"data": "f",
"schema_id": "maxLength_1_0",
"action": "validate",
"expect": {
"success": true
}
},
{
"description": "too long is invalid",
"data": "foo",
"schema_id": "maxLength_1_0",
"action": "validate",
"expect": {
"success": false,
"errors": [
{
"code": "MAX_LENGTH_VIOLATED",
"values": {
"count": "3",
"limit": "2"
},
"details": {
"path": "",
"schema": "maxLength_1_0"
}
}
]
}
}
]
}
]