I have an API which returns response in the format
[
{"id": 12345,
"value": "some_string",
"practice_id": "12344"},
{"id": 12346,
"value": "some_other_string",
"practice_id": "12345"},
]
I am testing that the response validates a specific JSON-Schema, and my schema test is
response.body.should.have.schema({
type: 'array',
required: ['id', 'value', 'practice_id'],
properties: {
id: {
type: 'number',
},
value: {
type: 'string',
},
practice_id: {
type: 'string',
minLength: 5,
}
}
});
The issue is that the test passes even if I change the type of id to string
or change the value of practice_id to number
, which is not correct.
What am I doing wrong here? I am using Postman-BDD to validate the responses.
Aucun commentaire:
Enregistrer un commentaire