Skip to content

Commit

Permalink
add baskets
Browse files Browse the repository at this point in the history
  • Loading branch information
glmn committed May 13, 2024
1 parent 5bbe577 commit 8cc5109
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const BASKETS = [
[1602, 1655],
[1656, 1919],
[1920, 2045],
[2046, 2189]
[2046, 2189],
[2091, 2405],
[2406, 2621]
];

const imageURL = (productId, imageType = "SMALL", order = 1) => {
Expand Down
1 change: 1 addition & 0 deletions src/WBPrivateAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class WBPrivateAPI {
const products = [];

const totalProducts = await this.searchTotalProducts(keyword);
console.log("totalProducts", totalProducts)
if (totalProducts === 0) return [];

const { catalog_type, catalog_value } = await this.getQueryMetadata(
Expand Down
6 changes: 3 additions & 3 deletions tests/WBPrivateAPI.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("Проверка поиска товаров WBPrivateAPI.search()", (
});

test('Сбор 3 страниц товаров по ключевому запросу "Платье"', async () => {
const catalog = await wbapi.search("Платье", 3, 3);
const catalog = await wbapi.search("платье", 3, 3);
expect(catalog.products.length).toBe(300);
});

Expand All @@ -67,8 +67,8 @@ describe("Проверка поиска товаров WBPrivateAPI.search()", (
});

test('Проверка фильтрации товаров по поставщику и ключевому запросу "торшер"', async () => {
const filters = [{ type: "fsupplier", value: 1180616 }];
const catalog = await wbapi.search("торшер", 1, 0, filters);
const filters = [{ type: "fsupplier", value: 36934 }];
const catalog = await wbapi.search("резинки зеленые для волос из ткани", 1, 0, filters);
expect(catalog.products.length).toBeGreaterThan(0);
expect(
catalog.products.every((p) => p.supplierId === filters[0].value)
Expand Down

0 comments on commit 8cc5109

Please sign in to comment.