refactor: Enhance environment configuration and loading mechanism
- Implement flexible environment variable loading strategy - Add support for environment-specific and local override configuration files - Create new `loadEnv.ts` module for dynamic environment configuration - Update configuration loading in multiple config files - Remove deprecated `.env.development.template` - Add setup script for environment validation - Improve WebSocket error handling and client configuration
This commit is contained in:
@@ -119,22 +119,17 @@ describe('WebSocket Event Handling', () => {
|
||||
|
||||
test('should handle connection errors', async () => {
|
||||
const errorPromise = new Promise((resolve) => {
|
||||
client.on('error', resolve);
|
||||
client.once('error', resolve);
|
||||
});
|
||||
|
||||
const connectPromise = client.connect().catch(() => { });
|
||||
const connectPromise = client.connect().catch(() => { /* Expected error */ });
|
||||
onOpenCallback();
|
||||
|
||||
const errorEvent = {
|
||||
error: new Error('Connection failed'),
|
||||
message: 'Connection failed',
|
||||
target: mockWebSocket
|
||||
};
|
||||
|
||||
onErrorCallback(errorEvent);
|
||||
const errorEvent = new Error('Connection failed');
|
||||
onErrorCallback({ error: errorEvent });
|
||||
|
||||
const error = await errorPromise;
|
||||
expect(error).toBeDefined();
|
||||
expect(error instanceof Error).toBe(true);
|
||||
expect((error as Error).message).toBe('Connection failed');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user