Replaced "baseUrl" with implicit "host" and fixed a minor bug regarding ordering
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
baseUrl="https://pdgw7l-8080.csb.app"
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
baseUrl="https://nw.rayvarz.center/api"
|
|
||||||
10
.httpyac.json
Normal file
10
.httpyac.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"environments": {
|
||||||
|
"nw-center": {
|
||||||
|
"host": "https://nw.rayvarz.center/api"
|
||||||
|
},
|
||||||
|
"mock-sandbox": {
|
||||||
|
"host": "https://pdgw7l-8080.csb.ap"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,16 +1,37 @@
|
|||||||
GET {{baseUrl}}/products?order=id.desc
|
{{
|
||||||
|
const axios = require('axios');
|
||||||
|
|
||||||
|
const wait = axios.get(`${host}/products`).then(res => {
|
||||||
|
let length = res.data.length;
|
||||||
|
let exists = res.data.find(item => item.id === 78);
|
||||||
|
if(length===78 && exists){
|
||||||
|
return axios.delete(`${host}/products?id=eq.78`)
|
||||||
|
.then(res => {
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
exports.wait = wait;
|
||||||
|
}}
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
GET /products?order=id.desc
|
||||||
?? status == 200
|
?? status == 200
|
||||||
?? js response.parsedBody[0].id == 77
|
?? js response.parsedBody[0].id == 77
|
||||||
|
|
||||||
?? js response.parsedBody[76].id == 1
|
?? js response.parsedBody[76].id == 1
|
||||||
###
|
###
|
||||||
|
|
||||||
GET {{baseUrl}}/products?order=id
|
GET /products?order=id
|
||||||
?? status == 200
|
?? status == 200
|
||||||
?? js response.parsedBody[0].id == 1
|
?? js response.parsedBody[0].id == 1
|
||||||
?? js response.parsedBody[76].id == 77
|
?? js response.parsedBody[76].id == 77
|
||||||
|
|
||||||
###
|
###
|
||||||
GET {{baseUrl}}/products?order=product_name.asc
|
|
||||||
|
GET /products?order=product_name.asc
|
||||||
?? status == 200
|
?? status == 200
|
||||||
?? js response.parsedBody[0].id == 17
|
?? js response.parsedBody[0].id == 17
|
||||||
?? js response.parsedBody[76].id == 47
|
?? js response.parsedBody[76].id == 47
|
||||||
@@ -18,7 +39,8 @@ GET {{baseUrl}}/products?order=product_name.asc
|
|||||||
?? js response.parsedBody[76].product_name startsWith Z
|
?? js response.parsedBody[76].product_name startsWith Z
|
||||||
|
|
||||||
###
|
###
|
||||||
GET {{baseUrl}}/products?order=product_name.desc
|
|
||||||
|
GET /products?order=product_name.desc
|
||||||
?? status == 200
|
?? status == 200
|
||||||
?? js response.parsedBody[0].id == 47
|
?? js response.parsedBody[0].id == 47
|
||||||
?? js response.parsedBody[76].id == 17
|
?? js response.parsedBody[76].id == 17
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
|
|
||||||
{{
|
{{
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
|
|
||||||
const wait = axios.get(`${baseUrl}/products`).then(res => {
|
const wait = axios.get(`${host}/products`).then(res => {
|
||||||
let length = res.data.length;
|
let length = res.data.length;
|
||||||
let exists = res.data.find(item => item.id === 78);
|
let exists = res.data.find(item => item.id === 78);
|
||||||
if(length===78 && exists){
|
if(length===78 && exists){
|
||||||
return axios.delete(`${baseUrl}/products?id=eq.78`)
|
return axios.delete(`${host}/products?id=eq.78`)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
@@ -17,7 +16,7 @@
|
|||||||
}}
|
}}
|
||||||
###
|
###
|
||||||
|
|
||||||
POST {{baseUrl}}/products
|
POST /products
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
Prefer: return=representation
|
Prefer: return=representation
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ Prefer: return=representation
|
|||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
POST {{baseUrl}}/products
|
POST /products
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
Prefer: return=headers-only
|
Prefer: return=headers-only
|
||||||
|
|
||||||
|
|||||||
22
Rest.http
22
Rest.http
@@ -1,11 +1,11 @@
|
|||||||
{{
|
{{
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
|
|
||||||
const wait = axios.get(`${baseUrl}/products`).then(res => {
|
const wait = axios.get(`${host}/products`).then(res => {
|
||||||
let length = res.data.length;
|
let length = res.data.length;
|
||||||
let exists = res.data.find(item => item.id === 78);
|
let exists = res.data.find(item => item.id === 78);
|
||||||
if(length===78 && exists){
|
if(length===78 && exists){
|
||||||
return axios.delete(`${baseUrl}/products?id=eq.78`)
|
return axios.delete(`${host}/products?id=eq.78`)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
@@ -16,20 +16,20 @@
|
|||||||
}}
|
}}
|
||||||
###
|
###
|
||||||
|
|
||||||
GET {{baseUrl}}/products/1
|
GET /products/1
|
||||||
?? status == 200
|
?? status == 200
|
||||||
?? body product_name == Chai
|
?? body product_name == Chai
|
||||||
?? body id == 1
|
?? body id == 1
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
GET {{baseUrl}}/products
|
GET /products
|
||||||
?? status == 200
|
?? status == 200
|
||||||
?? body length == 77
|
?? body length == 77
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
POST {{baseUrl}}/products
|
POST /products
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -62,13 +62,13 @@ Content-Type: application/json
|
|||||||
"units_on_order": 0,
|
"units_on_order": 0,
|
||||||
"reorder_level": 10
|
"reorder_level": 10
|
||||||
}
|
}
|
||||||
const wait = axios.post(`${baseUrl}/products`, postData, {headers:{ 'Content-Type': 'application/json'} }).then(res => {
|
const wait = axios.post(`${host}/products`, postData, {headers:{ 'Content-Type': 'application/json'} }).then(res => {
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
exports.wait = wait;
|
exports.wait = wait;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
PATCH {{baseUrl}}/products?id=eq.78
|
PATCH /products?id=eq.78
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -80,7 +80,7 @@ Content-Type: application/json
|
|||||||
const {expect} = require('chai');
|
const {expect} = require('chai');
|
||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
|
|
||||||
const wait = axios.get(`${baseUrl}/products?id=eq.78`).then(res => {
|
const wait = axios.get(`${host}/products?id=eq.78`).then(res => {
|
||||||
test("Check Patch", () =>
|
test("Check Patch", () =>
|
||||||
{
|
{
|
||||||
expect(res.data[0].product_name).to.equal("Saffaron-patch")
|
expect(res.data[0].product_name).to.equal("Saffaron-patch")
|
||||||
@@ -106,20 +106,20 @@ Content-Type: application/json
|
|||||||
"units_on_order": 0,
|
"units_on_order": 0,
|
||||||
"reorder_level": 10
|
"reorder_level": 10
|
||||||
}
|
}
|
||||||
const wait = axios.post(`${baseUrl}/products`, postData, {headers:{ 'Content-Type': 'application/json'} } ).then(res => {
|
const wait = axios.post(`${host}/products`, postData, {headers:{ 'Content-Type': 'application/json'} } ).then(res => {
|
||||||
return null;
|
return null;
|
||||||
})
|
})
|
||||||
exports.wait = wait;
|
exports.wait = wait;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
DELETE {{baseUrl}}/products?id=eq.78
|
DELETE /products?id=eq.78
|
||||||
?? status == 204
|
?? status == 204
|
||||||
|
|
||||||
{{
|
{{
|
||||||
const {expect} = require('chai');
|
const {expect} = require('chai');
|
||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
|
|
||||||
const wait = axios.get(`${baseUrl}/products`).then(res => {
|
const wait = axios.get(`${host}/products`).then(res => {
|
||||||
test("Check for Delete", () => {
|
test("Check for Delete", () => {
|
||||||
expect(res.data.length).to.equal(77);
|
expect(res.data.length).to.equal(77);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user