Skip to content

test(wallets): integration test for /wallets/:address/holdings (issue #429)#437

Open
Topmatrixmor2014 wants to merge 1 commit into
accesslayerorg:mainfrom
Topmatrixmor2014:fix/issue-429-wallet-holdings-integration-test
Open

test(wallets): integration test for /wallets/:address/holdings (issue #429)#437
Topmatrixmor2014 wants to merge 1 commit into
accesslayerorg:mainfrom
Topmatrixmor2014:fix/issue-429-wallet-holdings-integration-test

Conversation

@Topmatrixmor2014

Copy link
Copy Markdown

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 filters balance > 0 at the database level so zero rows never round-trip.
  • httpGetWalletHoldings controller — re-validates the :address path param with StellarAddressSchema, calls the service, and returns the standard { holdings, total_portfolio_value } envelope.
  • walletRouter — new router mounted under /wallets in the modules index.
  • wallet-holdings.integration.test.ts — 12 integration test cases pinning down the acceptance criteria and adjacent edge cases.

Acceptance criteria

  • Test seeds two creators with different balances for a test wallet and asserts both entries are returned with correct balances.
  • Test asserts zero-balance creators are excluded.

Files

  • src/modules/ownership/ownership.service.ts — added fetchWalletHoldings + exported KeyOwnership type
  • src/modules/wallet/wallet.controllers.ts — new controller
  • src/modules/wallet/wallet.routes.ts — new router
  • src/modules/wallet/wallet-holdings.integration.test.ts — new integration test
  • src/modules/index.ts — mounts walletRouter at /wallets

Test results locally

  • pnpm test -- src/modules/wallet/wallet-holdings.integration.test.ts → 12/12 passing
  • pnpm test -- src/modules/ownership/ → 6/6 passing
  • pnpm test -- src/middlewares/wallet-ownership.middleware.test.ts → 10/10 passing
  • pnpm exec eslint on changed files → clean

Closes #429

…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
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.

Add integration test for wallet holdings endpoint returning correct key balances

1 participant