feat: add pricing provider boundary
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-09 11:19:27 -04:00
parent 7c4a299838
commit 4effebd2f8
8 changed files with 135 additions and 1 deletions
@@ -34,4 +34,16 @@ test('requires a reason for an audited market-value override', async () => {
() => service.override({ sellerId: 'seller-1', actorUserId: 'user-1', inventoryItemId: 'inventory-1', valueMinor: 2000, reason: 'x' }),
(error) => error.code === 'OVERRIDE_REASON_REQUIRED' && error.statusCode === 400,
);
});
test('fails clearly when a requested pricing provider is unavailable', async () => {
const service = createPricingService({
pricingRepository: {},
pricingProviderRegistry: { get() { return null; } },
});
await assert.rejects(
() => service.refresh({ sellerId: 'seller-1', inventoryItemId: 'inventory-1', providerId: 'missing' }),
(error) => error.code === 'PRICING_PROVIDER_UNAVAILABLE' && error.statusCode === 503,
);
});