Description: Build an End-to-End (E2E) integration test suite for our core REST endpoints (specifically /swaps and /portfolio/:address). The tests must spin up a local test database, inject mock swap data, and execute HTTP assertions against the running API.
Context / Motivation: Unit tests alone cannot guarantee the API behaves correctly when the router, database ORM, and controllers interact. E2E tests act as our final safety net before deploying backend updates to production, ensuring no regressions break the frontend.
Acceptance Criteria: - [ ] Setup Supertest alongside Jest (or Mocha/Chai) to execute HTTP requests against the Express app.
Description: Build an End-to-End (E2E) integration test suite for our core REST endpoints (specifically
/swapsand/portfolio/:address). The tests must spin up a local test database, inject mock swap data, and execute HTTP assertions against the running API.Context / Motivation: Unit tests alone cannot guarantee the API behaves correctly when the router, database ORM, and controllers interact. E2E tests act as our final safety net before deploying backend updates to production, ensuring no regressions break the frontend.
Acceptance Criteria: - [ ] Setup
SupertestalongsideJest(orMocha/Chai) to execute HTTP requests against the Express app.beforeAllhook that initializes a temporary test database and runs migrations./swapsand accurate math calculations on/portfolio.afterAllhook.Technical Pointers: To prevent port conflicts during test execution, ensure the test server binds to an ephemeral port (port
0) or bypasses network binding entirely by passing the Express app directly into Supertest.