Skip to content

nd-to-end loan lifecycle test with in-memory mock infrastructure#52

Merged
EmeditWeb merged 1 commit into
StepFi-app:mainfrom
Adeyemi-cmd:implement_full_e2e_test
Jun 19, 2026
Merged

nd-to-end loan lifecycle test with in-memory mock infrastructure#52
EmeditWeb merged 1 commit into
StepFi-app:mainfrom
Adeyemi-cmd:implement_full_e2e_test

Conversation

@Adeyemi-cmd

Copy link
Copy Markdown
Contributor

close #28

PR Description

Summary

Adds a full end-to-end loan lifecycle test suite covering the complete
flow from wallet authentication through full loan repayment. All
external dependencies (Supabase, Soroban, Stellar contract clients,
Redis cache) are mocked with an in-memory store so tests run in
isolation without a live testnet.

Changes

New files

  • test/e2e/loan-lifecycle.e2e-spec.ts — 13 tests across 8
    describe blocks: Auth Flow, Learner Profile, Vendor Setup, Loan
    Application, Loan Approval, Installment Repayment, Reputation Check,
    Full Repayment.
  • test/e2e/helpers/test-wallet.tscreateTestKeypair() (wraps
    Keypair.random) and signMessage() (wraps Keypair.sign).
  • test/e2e/helpers/test-setup.tsbuildTestApp() creates a
    NestJS test module with all required modules imported and provider
    overrides for Supabase, Soroban, all 5 contract clients, and
    CACHE_MANAGER. Includes InMemoryStore (per-table row storage)
    and MockQueryBuilder (handles select/insert/upsert/update/delete
    with eq/is/in filters, sort, range, limit).

Modified files

  • test/__mocks__/stellar-sdk.js — Extended the auto-applied mock
    with Keypair.fromPublicKey (returns { verify: fn(() => true) }),
    Keypair.random (returns { sign, verify, publicKey }), Account
    class, and Horizon.Server mock.
  • src/modules/reputation/reputation.controller.ts — Swapped route
    registration order so @Get('me') is declared before
    @Get(':wallet') to prevent Express from matching me as a wallet
    parameter.

@EmeditWeb EmeditWeb merged commit 5a4efa0 into StepFi-app:main Jun 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: implement full e2e test suite for loan lifecycle

2 participants