UNPKG

@orchard9ai/error-handling

Version:

Federated error handling package with go-core-http-toolkit format support and logging integration

50 lines (42 loc) 1.23 kB
import { describe, it, expect } from 'vitest'; import { HttpClient, createHttpClient, configureGlobalErrorHandling, ErrorSeverity, ErrorCategory } from './index'; describe('Error Handling Package', () => { it('should export HttpClient class', () => { expect(HttpClient).toBeDefined(); expect(typeof HttpClient).toBe('function'); }); it('should create HTTP client instance', () => { const client = createHttpClient({ baseUrl: 'http://localhost:8080', enableRetry: false }); expect(client).toBeInstanceOf(HttpClient); }); it('should configure global error handling', () => { const handler = configureGlobalErrorHandling({ enabled: true, showToasts: false, logToConsole: false }); expect(handler).toBeDefined(); }); it('should export error enums', () => { expect(ErrorSeverity.High).toBe('high'); expect(ErrorCategory.Network).toBe('network'); }); it('should handle HTTP client configuration', () => { const client = new HttpClient({ baseUrl: 'http://example.com', enableRetry: false, showToasts: false, timeout: 5000 }); expect(client).toBeInstanceOf(HttpClient); }); });