Skip to content

test: Add Comprehensive Unit Tests for Mainnet-Ready Staking & Liquidity Functions#54

Closed
lohit-40 wants to merge 2 commits into
Stellar-Tools:mainfrom
lohit-40:feat/unit-tests-stakeF-contract
Closed

test: Add Comprehensive Unit Tests for Mainnet-Ready Staking & Liquidity Functions#54
lohit-40 wants to merge 2 commits into
Stellar-Tools:mainfrom
lohit-40:feat/unit-tests-stakeF-contract

Conversation

@lohit-40

@lohit-40 lohit-40 commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

Description

This PR complements PR #53 by introducing deterministic, high-quality unit tests for the mainnet-upgraded functions in lib/stakeF.ts and lib/contract.ts. These tests ensure the SDK correctly handles network switching and gracefully interacts with the Soroban RPC environment.

Changes

  • Added tests/unit/lib/contract.test.ts (14 comprehensive test cases)
  • Added tests/unit/lib/stakeF.test.ts (16 comprehensive test cases)
  • Used robust module-level mocking (vi.mock) to intercept @stellar/stellar-sdk RPC and transaction building.
  • Verified all edge cases, input formats, read-only simulations, and transaction failures without dialing out to a live, mutable network.
  • Updated .env.example to document the new STELLAR_NETWORK and SOROBAN_RPC_URL variables.

Summary by cubic

Adds deterministic unit tests for lib/stakeF.ts and lib/contract.ts to validate mainnet-ready staking and liquidity flows with mocked @stellar/stellar-sdk RPC. Updates env config for network selection and Soroban RPC, and fixes a missing type import in agent.ts.

  • Bug Fixes

    • Align stakeF.test.ts call signatures with lib/stakeF.ts.
    • Import TargetChain in agent.ts to fix type usage.
  • Migration

    • Set STELLAR_NETWORK to testnet or mainnet (default testnet).
    • Use SOROBAN_RPC_URL instead of SRB_PROVIDER_URL (keep as legacy alias if needed).

Written for commit 810d0ac. Summary will update on new commits.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

@daiwikmh

Copy link
Copy Markdown
Contributor

ci checks fail

@daiwikmh daiwikmh closed this Apr 30, 2026
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.

2 participants