const baseConfig = require('../jest.config.js')

module.exports = {
  ...baseConfig,
  displayName: 'HTTP Client Module',
  testMatch: [
    '<rootDir>/tests/**/*http-client*.test.ts',
    '<rootDir>/tests/contract/*http-client*.contract.test.ts',
    '<rootDir>/tests/contract/*platform-adapter*.contract.test.ts',
    '<rootDir>/tests/integration/*credential-auth*.integration.test.ts',
    '<rootDir>/tests/integration/*proxy-routing*.integration.test.ts',
    '<rootDir>/tests/integration/*pacifica-balance*.integration.test.ts',
    '<rootDir>/tests/integration/*multi-platform-concurrent*.integration.test.ts',
    '<rootDir>/tests/performance/*response-time*.performance.test.ts',
    '<rootDir>/tests/unit/*error-handling*.unit.test.ts',
    '<rootDir>/tests/unit/*connection-pool*.unit.test.ts'
  ],
  setupFilesAfterEnv: [
    '<rootDir>/tests/setup.ts',
    '<rootDir>/tests/http-client-setup.ts'
  ],
  testTimeout: 30000,
  collectCoverageFrom: [
    'src/core/http-client/**/*.ts',
    'src/adapters/**/*HttpAdapter.ts',
    'src/types/httpClient*.ts',
    'src/types/platformAdapter.ts',
    '!**/*.d.ts',
    '!**/*.test.ts',
    '!**/*.spec.ts'
  ],
  coverageThreshold: {
    global: {
      branches: 80,
      functions: 80,
      lines: 80,
      statements: 80
    }
  },
  moduleNameMapping: {
    '^@/(.*)$': '<rootDir>/src/$1',
    '^@/core/(.*)$': '<rootDir>/src/core/$1',
    '^@/types/(.*)$': '<rootDir>/src/types/$1',
    '^@/utils/(.*)$': '<rootDir>/src/utils/$1',
    '^@/adapters/(.*)$': '<rootDir>/src/adapters/$1'
  }
}