/**
 * Integration test setup
 * Runs before all integration tests
 */

// Set test environment variables
process.env.NODE_ENV = 'test';
process.env.TEST_DB_HOST = process.env.TEST_DB_HOST || 'localhost';
process.env.TEST_DB_PORT = process.env.TEST_DB_PORT || '5432';
process.env.TEST_DB_USER = process.env.TEST_DB_USER || 'postgres';
process.env.TEST_DB_PASSWORD = process.env.TEST_DB_PASSWORD || 'postgres';
process.env.TEST_DB_NAME = process.env.TEST_DB_NAME || 'xpeditis_test';

// Redis test configuration
process.env.REDIS_HOST = process.env.REDIS_HOST || 'localhost';
process.env.REDIS_PORT = process.env.REDIS_PORT || '6379';
process.env.REDIS_DB = '1'; // Use DB 1 for tests

// Carrier API test configuration
process.env.MAERSK_API_BASE_URL = 'https://api.maersk.com';
process.env.MAERSK_API_KEY = 'test-api-key';

// Increase test timeout for integration tests
jest.setTimeout(30000);

// Global test helpers
global.console = {
  ...console,
  // Suppress console logs during tests (optional)
  // log: jest.fn(),
  // debug: jest.fn(),
  // info: jest.fn(),
  // warn: jest.fn(),
  error: console.error, // Keep error logs
};
