ice/jest.config.js
Claude Code a537072d3d Add comprehensive tests for i18n routes and fix route ordering
- Add 19 integration tests for i18n API routes with 100% coverage
- Fix Express route ordering: specific routes (/detect) before parameterized routes (/:locale)
- Test all endpoints: locale translations, available locales, locale detection
- Test error cases: unsupported locales, missing translations, malformed headers
- Test HTTP caching headers and content-type validation
- Include i18n routes in coverage collection (was previously excluded)

Coverage improvement: 147 tests total (+19), 79.9% statements (+1.2%)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-07 20:50:34 -04:00

35 lines
1 KiB
JavaScript

module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/src', '<rootDir>/tests'],
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/*.(test|spec).+(ts|tsx|js)'
],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest'
},
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/swagger.ts', // Skip swagger spec file
'!src/types/**/*', // Skip type definitions
'!src/server.ts', // Skip main server as it's integration-focused
'!src/frontend/**/*', // Skip frontend files (use DOM types, tested separately)
'!src/i18n/**/*', // Skip i18n files (utility functions, tested separately)
'!src/services/MapImageService.ts' // Skip map service (requires external API, tested separately)
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
coverageThreshold: {
global: {
branches: 60,
functions: 65,
lines: 65,
statements: 65
}
},
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
testTimeout: 10000,
verbose: true
};