Skip to content

Commit

Permalink
DOCS-3209: Use same response schema for GET /products/by-price and GE…
Browse files Browse the repository at this point in the history
…T /products (#47)
  • Loading branch information
Shadid12 authored Aug 19, 2024
1 parent 7a42127 commit e076a0e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
8 changes: 4 additions & 4 deletions __tests__/products.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,12 @@ describe("Products", () => {
`/products/by-price?minPrice=${minPrice}&maxPrice=${maxPrice}`
);
expect(res.status).toEqual(200);
expect(res.body.data.length).toBeGreaterThan(0);
for (const product of res.body.data) {
expect(res.body.results.length).toBeGreaterThan(0);
for (const product of res.body.results) {
expect(product.price).toBeGreaterThanOrEqual(minPrice);
expect(product.price).toBeLessThanOrEqual(maxPrice);
expect(Object.keys(product).sort()).toEqual(
["name", "description", "price", "stock"].sort()
["name", "category", "id", "description", "price", "stock"].sort()
);
}
});
Expand All @@ -342,7 +342,7 @@ describe("Products", () => {
`/products/by-price?minPrice=${minPrice}&maxPrice=${maxPrice}`
);
expect(res.status).toEqual(200);
expect(res.body.data.length).toEqual(0);
expect(res.body.results.length).toEqual(0);
});
});
});
Loading

0 comments on commit e076a0e

Please sign in to comment.