Project 7 by Landon Parris
In this project, I had to create javaScript code (in Visual Studio Code) to do positive testing on the Urban Grocers API, as and use npx jest to test these codes. I also used Postman to test the endpoints GET, POST, PUT, and DLELTE in the Urban Grocers API. I used javaScript commands such as const, let, try, catch, and expect in my code
Pre Conditions
- Copy Urban Grocers API URL to the config.js file in the hm07-qa-us folder
- Run "npm install" in your console in the hm07-qa-us folder
Testing getHandlers "GET" URL/api/v1/warehouses
- GET test 1 checks that getting a list of available warehouses returns a 200 status code
- GET test 2 checks that the correct json body response is recieved for one of the warehouse names --to run these codes enter "npx jest tests/getHandlers.test.js" in the console while in the hm07-qa-us folder.
Testing postHandlers "POST" URL/api/v1/couriers/check
- POST test 1 checks getting a delivery cost returns a 200 status code
- POST test 2 checks the the correct delivery cost is shown in response --to run these codes enter "npx jest tests/postHandlers.test.js" in the console while in the hm07-qa-us folder.
Testing putHandlers "PUT" URL/api/v1/products/1
- PUT test 1 checks that making a change to the price of an item returns a 200 status code
- PUT test 2 checks making a change to the price of an item reflects the correct respons of "true" --to run these codes enter "npx jest tests/putHandlers.test.js" in the console while in the hm07-qa-us folder.
Testing deleteHandlers "POST" URL/api/v1/kits then "DELETE" URL/api/v1/kits/7
- DELETE test 1 creates a kit then deletes it to validate a 200 status code is returned
- DELETE test 2 creates a kit then deletes it to validate a "true" response is returned --to run these codes enter "npx jest tests/deleteHandlers.test.js" in the console while in the hm07-qa-us folder.