mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-04-20 03:02:51 -04:00
Support explicit proxy disabling and ambient proxy fallback without leaking env state into config. Improve first-run detection, endpoint-specific error messaging, diff exclusions, and runtime helper boundaries covered by unit tests.
30 lines
896 B
TypeScript
30 lines
896 B
TypeScript
import {
|
|
formatUserFriendlyError,
|
|
ServiceUnavailableError
|
|
} from '../../src/utils/errors';
|
|
|
|
describe('formatUserFriendlyError', () => {
|
|
it('should keep provider wording when no custom API URL is configured', () => {
|
|
const formatted = formatUserFriendlyError(
|
|
new ServiceUnavailableError('openai'),
|
|
'openai'
|
|
);
|
|
|
|
expect(formatted.message).toEqual(
|
|
'The openai service is temporarily unavailable.'
|
|
);
|
|
});
|
|
|
|
it('should use configured endpoint wording when a custom API URL is provided', () => {
|
|
const formatted = formatUserFriendlyError(
|
|
new ServiceUnavailableError('openai'),
|
|
'openai',
|
|
{ baseURL: 'http://127.0.0.1:1234/v1' }
|
|
);
|
|
|
|
expect(formatted.message).toContain('configured API endpoint');
|
|
expect(formatted.message).toContain('127.0.0.1:1234');
|
|
expect(formatted.message).not.toContain('openai service');
|
|
});
|
|
});
|