This commit is contained in:
@@ -44,4 +44,30 @@ test('accepts a CSRF-protected market-value override', async (testContext) => {
|
||||
assert.equal(response.statusCode, 201);
|
||||
assert.equal(received.actorUserId, 'user-1');
|
||||
assert.equal(response.json().data.valueMinor, 2600);
|
||||
});
|
||||
|
||||
test('returns a clear unavailable response when no provider is configured', async (testContext) => {
|
||||
const app = buildApp({
|
||||
authenticateAdmin: async () => ({ sellerId: 'seller-1' }),
|
||||
authorizeUnsafeRequest: async () => {},
|
||||
pricingService: {
|
||||
async refresh() {
|
||||
const error = new Error('Pricing provider is not configured.');
|
||||
error.code = 'PRICING_PROVIDER_UNAVAILABLE';
|
||||
error.statusCode = 503;
|
||||
throw error;
|
||||
},
|
||||
},
|
||||
});
|
||||
testContext.after(() => app.close());
|
||||
|
||||
const response = await app.inject({
|
||||
method: 'POST',
|
||||
url: '/api/v1/admin/inventory/inventory-1/pricing/refresh',
|
||||
headers: { 'x-csrf-token': 'csrf' },
|
||||
payload: { providerId: 'missing' },
|
||||
});
|
||||
|
||||
assert.equal(response.statusCode, 503);
|
||||
assert.equal(response.json().error.code, 'PRICING_PROVIDER_UNAVAILABLE');
|
||||
});
|
||||
Reference in New Issue
Block a user