Skip to content

[Testing] Offline Horizon RPC Mocking for Stellar SDK #167

Description

@AlAfiz

Description: Implement a robust HTTP mocking layer intercepting outbound requests from the @stellar/stellar-sdk to the Horizon RPC.
Context / Motivation: Running backend tests shouldn't require an active internet connection or rely on the rate-limited public testnet Horizon nodes. Offline mocking ensures our CI pipelines run blazingly fast and predictably.
Acceptance Criteria: - [ ] Integrate a mocking library like nock or msw (Mock Service Worker).

  • Capture and store raw JSON responses from Horizon for standard calls (e.g., fetching account balances, fee stats).
  • Configure the test suite to intercept SDK network calls and return these stored JSON fixtures instead.
  • Write a test asserting that API handles a mocked 504 Gateway Timeout from Horizon gracefully.
    Technical Pointers: The Stellar SDK relies heavily on standard HTTP requests under the hood. You will need to explicitly mock the exact URL paths (e.g., https://horizon-testnet.stellar.org/accounts/...) that the server utilizes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official Campaignhelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions