fix(prestashop): poll orders every minute in release 1.1.7

This commit is contained in:
fatequod
2026-09-10 15:58:54 +02:00
parent 57c95fa83d
commit 7c917d7a59
11 changed files with 643 additions and 16 deletions
+27
View File
@@ -80,3 +80,30 @@ test('preserves the explicitly allowed product partial-success compatibility pat
assert.deepEqual(await api.makeRequest('products/1', 'GET', null, true), { product: { id: 1 } });
});
test('looks up combinations and stock locations with exact product filters', async t => {
const originalFetch = Core.fetch;
t.after(() => { Core.fetch = originalFetch; });
const urls = [];
Core.fetch = async url => {
urls.push(url);
if (url.includes('combinations')) return response(200, { combinations: [{ id: '10' }] });
return response(200, { stock_availables: [{ id: '20' }] });
};
const api = new PrestashopApi('https://shop.example', 'secret', true, { maxGetAttempts: 1 });
assert.deepEqual(await api.findProductCombinationsByReference('1', 'SKU-1'), [{ id: '10' }]);
assert.deepEqual(await api.getStockAvailabilities('1', '10'), [{ id: '20' }]);
assert.match(urls[0], /filter%5Bid_product%5D=%5B1%5D/);
assert.match(urls[0], /filter%5Breference%5D=%5BSKU-1%5D/);
assert.match(urls[1], /filter%5Bid_product_attribute%5D=%5B10%5D/);
});
test('does not turn an unsafe reference filter into an empty combination match', async t => {
const originalFetch = Core.fetch;
t.after(() => { Core.fetch = originalFetch; });
Core.fetch = async () => assert.fail('must not issue a broadened combination lookup');
const api = new PrestashopApi('https://shop.example', 'secret', true, { maxGetAttempts: 1 });
assert.equal(await api.findProductCombinationsByReference('1', 'SKU[1]'), null);
});