feat: Add integration test suite for Position Manager

- 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>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-05 00:16:12 +00:00
parent 52ff787352
commit 4f793ec22a
14 changed files with 4698 additions and 196 deletions

View File

@@ -7,7 +7,11 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test:ci": "jest --ci --coverage --reporters=default --reporters=jest-junit"
},
"dependencies": {
"@drift-labs/sdk": "^2.75.0",
@@ -30,9 +34,13 @@
},
"devDependencies": {
"@types/bn.js": "^5.2.0",
"@types/jest": "^29.5.14",
"@types/node": "^20.11.0",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.3.0"
},