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
@@ -79,6 +79,40 @@ test('does not archive sold inventory items', async () => {
);
});
test('enqueues pricing refresh jobs for owned inventory items', async () => {
const enqueued = [];
const service = createInventoryItemService({
productRepository: { async findById() { return null; } },
conditionRepository: { async findById() { return null; } },
inventoryItemRepository: {
async listBySellerId() {
return [{ id: 'item-1', productId: 'product-1', conditionId: 'condition-1', status: 'ACTIVE' }];
},
},
pricingService: {
async enqueueRefresh(input) {
enqueued.push(input);
return { id: 'job-1', status: 'PENDING' };
},
},
});
const jobs = await service.refreshPricingMany({
inventoryItemIds: ['item-1'],
sellerId: 'seller-id',
providerId: 'fixture-provider',
});
assert.deepEqual(enqueued, [{
sellerId: 'seller-id',
inventoryItemId: 'item-1',
providerId: 'fixture-provider',
productId: 'product-1',
conditionId: 'condition-1',
}]);
assert.deepEqual(jobs, [{ id: 'job-1', status: 'PENDING' }]);
});
test('rejects conditions from another category', async () => {
const service = createService({
product: { id: 'product-id', sellerId: 'seller-id', categoryId: 'cards' },