chore: upgrade @orbito/api-lib to 3.3.3
Lock TTL is now passed in seconds, matching what the core lock RPC methods expect and what the 3.x SDK documents as ttlSeconds. The presta-api timeout test no longer drains the event loop: it drives the unref-ed timeout timer through node:test mock timers instead of real ones. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LpoFvfAbnMmkSJFRc867XA
This commit is contained in:
@@ -56,12 +56,20 @@ test('rejects non-retryable 4xx and invalid JSON', async t => {
|
||||
test('times out stalled requests', async t => {
|
||||
const originalFetch = Core.fetch;
|
||||
t.after(() => { Core.fetch = originalFetch; });
|
||||
// Timer timeoutu w fetchWithTimeout jest `unref`-owany, a Core.fetch nigdy się tu nie rozwiązuje,
|
||||
// więc na prawdziwych timerach pętla zdarzeń pustoszeje i node:test anuluje ten test.
|
||||
// Mockowany setTimeout pozwala wysterować timeout ręcznie przez tick().
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
Core.fetch = async () => new Promise(() => {});
|
||||
const api = new PrestashopApi('https://shop.example', 'secret', true, {
|
||||
timeoutMs: 5, maxGetAttempts: 1,
|
||||
});
|
||||
|
||||
await assert.rejects(() => api.makeRequest('orders', 'GET'), /timed out/);
|
||||
const pending = api.makeRequest('orders', 'GET');
|
||||
await new Promise(resolve => setImmediate(resolve));
|
||||
t.mock.timers.tick(10);
|
||||
|
||||
await assert.rejects(() => pending, /timed out/);
|
||||
});
|
||||
|
||||
test('preserves the explicitly allowed product partial-success compatibility path', async t => {
|
||||
|
||||
Reference in New Issue
Block a user