Skip to content

test: cover Stellar DEX price source#44

Open
ProtonsAndElectrons wants to merge 1 commit into
SmartDropLabs:mainfrom
ProtonsAndElectrons:codex/stellar-dex-source-tests
Open

test: cover Stellar DEX price source#44
ProtonsAndElectrons wants to merge 1 commit into
SmartDropLabs:mainfrom
ProtonsAndElectrons:codex/stellar-dex-source-tests

Conversation

@ProtonsAndElectrons

Copy link
Copy Markdown
Contributor

Summary

  • Add mocked Horizon coverage for the Stellar DEX source orderbook scenarios from Add Stellar DEX source integration tests with mocked Horizon #33.
  • Fix the source to use Horizon.Server/Asset from stellar-sdk v11 instead of the missing top-level Server export.
  • Derive prices from the midpoint of best bid/ask, fall back to one-sided books, return null for empty books, and surface Horizon failures to the oracle layer.
  • Ensure native XLM uses the XLM/USDC orderbook and issued assets convert asset/XLM through XLM/USD.

Fixes #33

Validation

  • npm test -- --runInBand (54 passed)
  • npx jest test/stellarDex.test.js --runInBand (9 passed)
  • npx jest test/stellarDex.test.js --runInBand --coverage --collectCoverageFrom=src/services/sources/stellarDex.js (stellarDex.js: 95.74% statements, 92.85% branches, 100% functions, 100% lines)
  • git diff --check

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 Stellar DEX source integration tests with mocked Horizon

1 participant