Skip to content

Instantly share code, notes, and snippets.

@subeshb1
Created June 10, 2020 14:16
Show Gist options
  • Save subeshb1/9d9f83ed3ef607a5bcf0512c74de2f9a to your computer and use it in GitHub Desktop.
Save subeshb1/9d9f83ed3ef607a5bcf0512c74de2f9a to your computer and use it in GitHub Desktop.
api-test with tests
{
"testCases": {
"get_api": {
"path": "/books",
"query": {
"id": "1"
},
"expect": {
"body": {
"contains": {
"author": "Aneeta Sharma"
},
"hasKey": ["id", "author", "title"]
},
"header": {
"contains": {
"http_status": "200"
}
}
}
},
"invalid_post_api": {
"path": "/books",
"method": "POST",
"body": {
"id": "1",
"author": "Robin Wieruch",
"title": "The Road to React"
},
"expect": {
"body": {
"eq": { "message": "Book already exists." }
}
}
}
},
"url": "localhost:3000",
"header": {
"Content-Type": "application/javascript"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment