I have a sample response:
{
"tags": [
{
"id": 1,
"name": "[String]",
"user_id": 1,
"created_at": "2016-12-20T15:50:37.000Z",
"updated_at": "2016-12-20T15:50:37.000Z",
"deleted_at": null
}
]
}
I've written a test for the response:
var schema = {
"type": "object",
"properties": {
"tags": {
"type": "object",
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"user_id": { "type": "number" },
"created_at": { "type": "string" },
"updated_at": { "type": "string" },
"deleted_at": { "type": ["string", "null"] }
}
}
}
};
var data = JSON.parse(responseBody);
tests["Valid schema"] = tv4.validate(data, schema);
This test returns [FAIL]. What wrongs in the test?
Thank you for a respond!