test(wallets): integration test for /wallets/:address/holdings (issue #429)#437
Open
Topmatrixmor2014 wants to merge 1 commit into
Conversation
…orrect key balances Implements acceptance criteria for issue accesslayerorg#429: GET /api/v1/wallets/:address/holdings seeds two creators with different non-zero balances plus a zero-balance row, returns both held entries with correct balances, and excludes zero balances end-to-end. - Add fetchWalletHoldings helper (DB-level balance > 0 filter) - Add httpGetWalletHoldings controller (path-param validation + envelope) - Add walletRouter mounted at /wallets - Add wallet-holdings.integration.test.ts covering acceptance criteria
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.
Summary
Implements the acceptance criteria for issue #429: integration test coverage for the wallet holdings endpoint.
What changes
GET /api/v1/wallets/:address/holdings— new endpoint returning the creator-key holdings owned by a Stellar wallet, with zero-balance entries excluded.fetchWalletHoldings(address)— new service helper that filtersbalance > 0at the database level so zero rows never round-trip.httpGetWalletHoldingscontroller — re-validates the:addresspath param withStellarAddressSchema, calls the service, and returns the standard{ holdings, total_portfolio_value }envelope.walletRouter— new router mounted under/walletsin the modules index.wallet-holdings.integration.test.ts— 12 integration test cases pinning down the acceptance criteria and adjacent edge cases.Acceptance criteria
Files
src/modules/ownership/ownership.service.ts— addedfetchWalletHoldings+ exportedKeyOwnershiptypesrc/modules/wallet/wallet.controllers.ts— new controllersrc/modules/wallet/wallet.routes.ts— new routersrc/modules/wallet/wallet-holdings.integration.test.ts— new integration testsrc/modules/index.ts— mountswalletRouterat/walletsTest results locally
pnpm test -- src/modules/wallet/wallet-holdings.integration.test.ts→ 12/12 passingpnpm test -- src/modules/ownership/→ 6/6 passingpnpm test -- src/middlewares/wallet-ownership.middleware.test.ts→ 10/10 passingpnpm exec eslinton changed files → cleanCloses #429