Last active
October 29, 2018 23:12
-
-
Save IamTechknow/1958be8b0227659f3cab9856991531a2 to your computer and use it in GitHub Desktop.
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
Here, my REST API calls are prepend with >, and the JSON response will be on the line after. | |
Test of listings endpoint with a given month and year | |
The JSON response is an array of arrays each containing the start and end dates of a reservation. | |
It is guaranteed that a succeeding reservation array has greater days that a prior one. | |
> http://127.0.0.1:3004/api/listings/0/reserved?month=7&year=2018 | |
[[3,6],[9,11],[12,15],[17,18],[20,21],[22,25],[30,31]] | |
> http://127.0.0.1:3004/api/listings/0/reserved?month=8&year=2018 | |
[[5,8],[12,13],[14,16],[16,18],[20,21],[27,29]] | |
> http://127.0.0.1:3004/api/listings/0/reserved?month=9&year=2018 | |
[[7,10],[10,13],[14,15],[16,18],[20,22],[25,26],[27,30]] | |
Test of listings endpoint with no query | |
> http://127.0.0.1:3004/api/listings/0/reserved | |
{"success" : false, "error" : "Month and/or year is missing in query."} | |
Test of compute endpoint with no query (defaults to 1 person, 1 night) | |
> http://127.0.0.1:3004/api/listings/0/compute | |
{"totalCost":157,"personPerNight":107,"cleaning":50} | |
Test of compute endpoint with nights and guests query | |
> http://127.0.0.1:3004/api/listings/0/compute?nights=3&guests=3 | |
{"totalCost":413,"personPerNight":121,"cleaning":50} | |
Test non-Integer IDs (should result in error response) | |
> http://127.0.0.1:3004/api/listings/test/compute?nights=3&guests=3 | |
{"success":false,"error":"ID is missing or is not a number"} | |
> http://127.0.0.1:3004/api/listings/test/reserved?month=7&year=2018 | |
{"success":false,"error":"ID is missing or is not a number"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment