Compare commits

...

10 Commits

Author SHA1 Message Date
alibw
97e416055c Added not expression tests 2025-06-18 14:51:50 +03:30
1f5fb1663e Added bulk json insert test 2025-05-28 17:47:44 +03:30
alibw
1ed2f3c836 Changed in Test 2024-11-16 18:23:01 +03:30
f148350b78 Merge pull request #5 from RayvarzTech/InOperator
In operator
2024-11-16 16:59:50 +03:30
fafb2ecd1b new line 2024-11-16 14:43:25 +03:30
alibw
61c2dfb392 Added in operator tests 2024-11-16 11:46:47 +03:30
9b0533631b Merge pull request #4 from RayvarzTech/Select
Added select tests
2024-11-12 09:35:24 +03:30
8e9fecf99a Added select tests 2024-11-11 15:42:31 +03:30
161be6f910 Merge pull request #3 from RayvarzTech/ContentRangeAndNEQ
Added new tests
2024-10-15 11:22:52 +03:30
dda925b8d6 Added new tests 2024-10-13 12:35:14 +03:30
5 changed files with 187 additions and 2 deletions

View File

@@ -21,4 +21,22 @@ GET /products
test('OK content-range', () => {
expect(response.headers['content-range']).to.equal(`0-${itemsCount - 1}/*`);
});
}}
}}
GET /products?offset=3&limit=8&unit_price=lt.14
Prefer: count=exact
?? status == 206
?? header content-range == 3-10/21
GET /products?offset=3&limit=25&unit_price=lt.14
Prefer: count=exact
?? status == 206
?? header content-range == 3-20/21
GET /products?offset=98&unit_price=lt.14
Prefer: count=exact
?? header content-range == */21
GET /products?limit=0&unit_price=lt.14
Prefer: count=exact
?? header content-range == */21

14
Not.http Normal file
View File

@@ -0,0 +1,14 @@
GET /Products?discontinued=not.is.false
?? status == 200
?? body length == 10
?? js response.parsedBody[0].product_name == Chai
?? js response.parsedBody[9].product_name == Perth Pasties
###
GET /Products?and=(id.lt.50,discontinued.not.is.false)
?? status == 200
?? body length == 9
?? js response.parsedBody[0].product_name == Chai
?? js response.parsedBody[8].product_name == Singaporean Hokkien Fried Mee

View File

@@ -29,4 +29,13 @@ GET /products?order=product_name.desc
?? js response.parsedBody[0].id == 47
?? js response.parsedBody[76].id == 17
?? js response.parsedBody[0].product_name startsWith Z
?? js response.parsedBody[76].product_name startsWith A
?? js response.parsedBody[76].product_name startsWith A
###
GET /products?order=id.desc&unit_price=lt.10
?? status == 200
?? js response.parsedBody[0].id == 75
?? js response.parsedBody[10].id == 13
?? js response.parsedBody[0].product_name startsWith R
?? js response.parsedBody[10].product_name startsWith K

View File

@@ -12,7 +12,45 @@ GET /products
?? body length == 77
###
GET /products?discontinued=neq.0
?? status == 200
?? body length == 10
###
GET /products?unit_price=is.null
?? status == 200
?? body length == 0
###
GET /products?product_name=in.(Chai,Chang,Aniseed Syrup)
?? status == 200
?? body length == 3
{{
const {expect} = require('chai');
let responseItems = JSON.parse(response.body);
test("OK in", () =>
{
expect(responseItems[0].id).to.equal(1);
expect(responseItems[1].id).to.equal(2);
expect(responseItems[2].id).to.equal(3);
})
}}
###
GET /products?id=in.(1,2,79)
?? status == 200
?? body length == 2
{{
const {expect} = require('chai');
let responseItems = JSON.parse(response.body);
test("OK in", () =>
{
expect(responseItems[0].id).to.equal(1);
expect(responseItems[1].id).to.equal(2);
})
}}
###
POST /products
Content-Type: application/json
@@ -30,6 +68,24 @@ Content-Type: application/json
}
?? status == 201
###
POST /products
Content-Type: application/json
[
{
"product_name": "Saffaron"
},
{
"product_name": "Chai"
},
{
"product_name": "sar"
}
]
?? status == 201
###
{{
const axios = require('axios');

88
Select.http Normal file
View File

@@ -0,0 +1,88 @@
GET /products?select=id,unit_price,discontinued,supplier_id
?? status == 200
?? body length == 77
{{
const { expect } = require('chai');
let actual = JSON.parse(response.body)[0];
let expected = {
id: 1,
unit_price: 18,
discontinued: 1,
supplier_id: 8
}
test('OK Select', () => {
expect(JSON.stringify(expected)).to.equal(JSON.stringify(actual));
});
}}
###
GET /products?select=id,unit_price,categories(category_name)
?? status == 200
?? body length == 77
{{
const { expect } = require('chai');
let actual = JSON.parse(response.body)[0];
let expected = {
id: 1,
unit_price: 18,
categories: {
category_name: "Beverages"
}
}
test('OK Select', () => {
expect(JSON.stringify(expected)).to.equal(JSON.stringify(actual));
});
}}
###
GET /categories?select=id,category_name,products(product_name)
?? status == 200
?? body length == 8
{{
const { expect } = require('chai');
let actual = JSON.parse(response.body)[0];
let expected = {
id: 1,
category_name: "Beverages",
products: [
{
product_name: "Chai"
},
{
product_name: "Chang"
},
{
product_name: "Guaraná Fantástica"
},
{
product_name: "Sasquatch Ale"
},
{
product_name: "Steeleye Stout"
},
{
product_name: "Côte de Blaye"
},
{
product_name: "Chartreuse verte"
},
{
product_name: "Ipoh Coffee"
},
{
product_name: "Laughing Lumberjack Lager"
},
{
product_name: "Outback Lager"
},
{
product_name: "Rhönbräu Klosterbier"
},
{
product_name: "Lakkalikööri"
}
]
}
test('OK Select', () => {
expect(JSON.stringify(expected)).to.equal(JSON.stringify(actual));
});
}}