- Added Jest + ts-jest configuration (jest.config.js) - Added global test setup with mocks (tests/setup.ts) - Added trade factory helpers (tests/helpers/trade-factory.ts) - Added 7 test suites covering Position Manager logic: - tp1-detection.test.ts (13 tests) - breakeven-sl.test.ts (9 tests) - adx-runner-sl.test.ts (18 tests) - trailing-stop.test.ts (14 tests) - edge-cases.test.ts (18 tests) - price-verification.test.ts (13 tests) - decision-helpers.test.ts (28 tests) - Added test documentation (tests/README.md) - Updated package.json with Jest dependencies and scripts - All 113 tests pass Co-authored-by: mindesbunister <32161838+mindesbunister@users.noreply.github.com>
30 lines
653 B
JavaScript
30 lines
653 B
JavaScript
/** @type {import('jest').Config} */
|
|
const config = {
|
|
preset: 'ts-jest',
|
|
testEnvironment: 'node',
|
|
roots: ['<rootDir>/tests'],
|
|
testMatch: ['**/*.test.ts'],
|
|
transform: {
|
|
'^.+\\.tsx?$': ['ts-jest', {
|
|
useESM: true,
|
|
tsconfig: {
|
|
module: 'ESNext',
|
|
moduleResolution: 'node',
|
|
},
|
|
}],
|
|
},
|
|
moduleNameMapper: {
|
|
'^@/(.*)$': '<rootDir>/$1',
|
|
},
|
|
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
|
|
collectCoverageFrom: [
|
|
'lib/trading/position-manager.ts',
|
|
'tests/**/*.ts',
|
|
],
|
|
coverageReporters: ['text', 'text-summary', 'html'],
|
|
verbose: true,
|
|
testTimeout: 10000,
|
|
}
|
|
|
|
module.exports = config
|