This commit is contained in:
@@ -46,4 +46,18 @@ test('fails clearly when a requested pricing provider is unavailable', async ()
|
||||
() => service.refresh({ sellerId: 'seller-1', inventoryItemId: 'inventory-1', providerId: 'missing' }),
|
||||
(error) => error.code === 'PRICING_PROVIDER_UNAVAILABLE' && error.statusCode === 503,
|
||||
);
|
||||
});
|
||||
|
||||
test('enqueues a seller-scoped pricing refresh and reads its status', async () => {
|
||||
const service = createPricingService({
|
||||
pricingRepository: {},
|
||||
pricingRefreshJobRepository: {
|
||||
async create(input) { return { id: 'job-1', status: 'PENDING', ...input }; },
|
||||
async findByIdForSeller(id, sellerId) { return { id, sellerId, status: 'COMPLETED' }; },
|
||||
},
|
||||
});
|
||||
|
||||
const job = await service.enqueueRefresh({ sellerId: 'seller-1', inventoryItemId: 'item-1', providerId: 'provider-1', productId: 'product-1', conditionId: 'condition-1' });
|
||||
assert.equal(job.status, 'PENDING');
|
||||
assert.equal((await service.getJob({ sellerId: 'seller-1', jobId: job.id })).status, 'COMPLETED');
|
||||
});
|
||||
Reference in New Issue
Block a user