Skip to content

test: add E2E test suite for complete BNPL flow #113

Description

@Josue19-08

🔖 Title

Add E2E test suite covering the complete BNPL loan lifecycle


📄 Description

The codebase has 15 unit test files but lacks end-to-end tests that validate the full BNPL flow from wallet registration through loan creation, repayment, and reputation update. E2E tests are critical to catch integration regressions that unit tests miss, especially around Stellar transaction building and Supabase state transitions.


✅ Tasks to complete

  • Set up E2E test environment: dedicated Supabase test schema, mock Stellar Horizon, mock Soroban RPC
  • Implement E2E test: Auth flow — register user → generate nonce → verify signature → receive JWT
  • Implement E2E test: Loan flow — get quote → create loan (XDR) → submit signed XDR → verify loan status in DB
  • Implement E2E test: Repayment flow — pay loan → verify payment recorded → verify loan status updated
  • Implement E2E test: Liquidity flow — deposit → get pool overview → withdraw
  • Implement E2E test: Notifications flow — trigger loan reminder job → verify notification created → mark as read
  • Add GitHub Actions step to run E2E tests in CI with test environment variables
  • Document how to run E2E tests locally in `docs/setup/`

📚 Documentation/context for AI

(This link never should removed)
https://github.com/TrustUp-app/TrustUp-API/tree/main/docs


🗒️ Additional notes

  • Use NestJS `@nestjs/testing` `createTestingModule` with SuperTest (Fastify adapter)
  • Mock Stellar SDK calls at the service boundary, not at the HTTP level
  • E2E tests should run in isolation — each test must clean up its own DB records
  • See `test/helpers/` for existing test utilities to reuse

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave program

    Type

    No type

    Fields

    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