feat: add bulk pricing refresh
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-10 00:07:29 -04:00
parent e0d231facc
commit 099ec2fe72
10 changed files with 205 additions and 11 deletions
+24
View File
@@ -68,4 +68,28 @@ test('archives selected admin inventory items through the bulk API', async () =>
} finally {
globalThis.fetch = originalFetch;
}
});
test('enqueues selected admin inventory pricing refreshes through the bulk API', async () => {
const originalFetch = globalThis.fetch;
globalThis.fetch = async (url, options) => {
assert.equal(url, '/api/v1/admin/bulk');
assert.equal(options.method, 'POST');
assert.equal(options.headers['x-csrf-token'], 'csrf-token');
assert.deepEqual(JSON.parse(options.body), {
action: 'PRICING_REFRESH',
inventoryItemIds: ['item-1'],
providerId: 'fixture-provider',
});
return { ok: true, async json() { return { data: [{ id: 'job-1', status: 'PENDING' }] }; } };
};
try {
const { refreshAdminInventoryPricing } = await import('../src/services/admin-catalog-service.js');
assert.deepEqual(await refreshAdminInventoryPricing(['item-1'], 'fixture-provider', 'csrf-token'), [
{ id: 'job-1', status: 'PENDING' },
]);
} finally {
globalThis.fetch = originalFetch;
}
});