Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. // Define the JSON Schema
  2. const customerSchema = {
  3. "required": ["id"],
  4. "properties": {
  5. "id": {
  6. "type": "integer",
  7. "minimum": 100,
  8. "maximum": 1000
  9. },
  10. "name": {
  11. "type": "string",
  12. "minLength": 1,
  13. "maxLength": 25
  14. }
  15. }
  16. };
  17.  
  18. // Test whether the response matches the schema
  19. var customer = JSON.parse(responseBody);
  20. tests["Customer is valid"] = tv4.validate(customer, customerSchema);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement