Skip to content

[Testing] E2E Integration Tests for Portfolio and Swap Endpoints #166

Description

@AlAfiz

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.

  • Write a beforeAll hook that initializes a temporary test database and runs migrations.
  • Create tests validating pagination structure on /swaps and accurate math calculations on /portfolio.
  • Ensure the test database is completely torn down in the afterAll hook.
    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.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaignhelp wantedExtra attention is needed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions