Skip to content

test(utils): add behavioral tests and error-fallback assertions for soroban utils (#1975) - #2000

Draft
s6pa1rta3n-lab wants to merge 1 commit into
Commitlabs-Org:masterfrom
s6pa1rta3n-lab:fix-issue-1975
Draft

s6pa1rta3n-lab wants to merge 1 commit into
Commitlabs-Org:masterfrom
s6pa1rta3n-lab:fix-issue-1975

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Summary

  • Restores src/utils/soroban.ts exporting lazy contract address getters (commitmentNFT, commitmentCore, attestationEngine) and network constants (rpcUrl, networkPassphrase).
  • Adds comprehensive behavioral test suite in src/utils/tests/soroban.test.ts for consistency with siblings.
  • Verifies default fallback values ('https://soroban-testnet.stellar.org:443', 'Test SDF Network ; September 2015') when env vars are unset, as well as environment overrides.
  • Verifies try/catch error-fallback-to-empty-string behavior for all getters when getContractAddress throws, as well as success paths.
  • Verifies absence of removed stubs (connectWallet, callContract, readContract).

Changes

  • src/utils/soroban.ts: Implements lazily evaluated contract address getters and network constants with JSDoc documentation and TypeScript contracts.
  • src/utils/tests/soroban.test.ts: Vitest test suite asserting:
    • Absence of removed stub functions (connectWallet, callContract, readContract).
    • Network configuration fallback defaults when env vars are unset.
    • Network configuration custom overrides when env vars are defined.
    • Getter structure and string return types.
    • Getter error-fallback behavior to empty string when getContractAddress throws.
    • Getter resolution behavior when getContractAddress returns valid contract addresses.

Verification

  • pnpm exec vitest run src/utils/tests/soroban.test.ts passes (9/9 tests).
  • pnpm exec vitest run src/utils/ passes (51/51 tests across all utils).
  • pnpm exec vitest --coverage run src/utils/tests/soroban.test.ts reports 100% statement, branch, function, and line coverage on src/utils/soroban.ts.
  • pnpm exec prettier --check src/utils/soroban.ts src/utils/tests/soroban.test.ts passes.
  • pnpm exec eslint src/utils/soroban.ts src/utils/tests/soroban.test.ts passes with zero errors.

Closes #1975

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

@vercel

vercel Bot commented Sep 28, 2026

Copy link
Copy Markdown

@s6pa1rta3n-lab is attempting to deploy a commit to the 1nonly's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

src/utils/soroban.ts's test file only asserts absence of removed stubs, not actual behavior

1 participant