nd-to-end loan lifecycle test with in-memory mock infrastructure#52
Merged
Merged
Conversation
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 8describe blocks: Auth Flow, Learner Profile, Vendor Setup, Loan
Application, Loan Approval, Installment Repayment, Reputation Check,
Full Repayment.
test/e2e/helpers/test-wallet.ts—createTestKeypair()(wrapsKeypair.random) andsignMessage()(wrapsKeypair.sign).test/e2e/helpers/test-setup.ts—buildTestApp()creates aNestJS test module with all required modules imported and provider
overrides for Supabase, Soroban, all 5 contract clients, and
CACHE_MANAGER. IncludesInMemoryStore(per-table row storage)and
MockQueryBuilder(handles select/insert/upsert/update/deletewith eq/is/in filters, sort, range, limit).
Modified files
test/__mocks__/stellar-sdk.js— Extended the auto-applied mockwith
Keypair.fromPublicKey(returns{ verify: fn(() => true) }),Keypair.random(returns{ sign, verify, publicKey }),Accountclass, and
Horizon.Servermock.src/modules/reputation/reputation.controller.ts— Swapped routeregistration order so
@Get('me')is declared before@Get(':wallet')to prevent Express from matchingmeas a walletparameter.