-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GET Store Inventory - Add Test Case and Assertion
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const assert = require("chai").assert; | ||
const expect = require("chai").expect; | ||
const request = require("supertest"); | ||
const baseUrl = 'https://petstore.swagger.io/v2' | ||
|
||
describe("PetStore Get Inventory - GET", () => { | ||
|
||
// test case | ||
it("1A Status Code should be 200", async () => { | ||
// request to URL | ||
const response = request(baseUrl) | ||
.get('/store/inventory'); | ||
console.log((await response).status); | ||
console.log((await response).body); | ||
// assertion | ||
// sometimes failed | ||
assert.equal((await response).status, 200); | ||
expect((await response).statusCode).equal(200); | ||
}) | ||
}) |