feat: resolve refresh providers from mappings
Quality / test (push) Canceled after 0s

This commit is contained in:
2026-09-09 13:01:16 -04:00
parent 4d3af37cd7
commit 4c041e069d
7 changed files with 55 additions and 4 deletions
@@ -70,4 +70,30 @@ test('enqueues a pricing refresh and exposes seller-scoped job status', async (t
const jobResponse = await app.inject({ method: 'GET', url: '/api/v1/admin/jobs/job-1' });
assert.equal(jobResponse.statusCode, 200);
assert.equal(jobResponse.json().data.status, 'COMPLETED');
});
test('returns a conflict when refresh has no active product mapping', async (testContext) => {
const app = buildApp({
authenticateAdmin: async () => ({ sellerId: 'seller-1' }),
authorizeUnsafeRequest: async () => {},
pricingService: {
async enqueueRefresh() {
const error = new Error('No active pricing provider mapping exists for this product.');
error.code = 'PRICING_PROVIDER_MAPPING_NOT_FOUND';
error.statusCode = 409;
throw error;
},
},
});
testContext.after(() => app.close());
const response = await app.inject({
method: 'POST',
url: '/api/v1/admin/inventory/item-1/pricing/refresh',
headers: { 'x-csrf-token': 'csrf' },
payload: { productId: 'product-1', conditionId: 'condition-1' },
});
assert.equal(response.statusCode, 409);
assert.equal(response.json().error.code, 'PRICING_PROVIDER_MAPPING_NOT_FOUND');
});