Skip to content

docs: add docs/testing-guide.md — SDK test authoring guide - #396

Merged
BigBen-7 merged 3 commits into
Lead-Studios:mainfrom
BashMan11:BashMan11/fix/issues-278-279-280
Jul 26, 2026
Merged

docs: add docs/testing-guide.md — SDK test authoring guide#396
BigBen-7 merged 3 commits into
Lead-Studios:mainfrom
BashMan11:BashMan11/fix/issues-278-279-280

Conversation

@BashMan11

Copy link
Copy Markdown
Contributor

Summary

Adds docs/testing-guide.md — a comprehensive guide for contributors who need to write both unit tests (mocked RPC) and integration tests (Stellar Testnet) for the SDK.

What's included

  • Unit test setup — how to use createMockClient, createMockServer, and createMockKeypair from tests/helpers/mocks.ts
  • Mocking Soroban RPC responses — using jest.spyOn and direct server injection patterns with examples
  • Testing read methodssimulateRead path with happy-path and error cases
  • Testing write methods — mocking sendTransaction / getTransaction, verifying READ_ONLY_CLIENT guard
  • Integration test setup — required env vars table, Friendbot funding (HTTP + Horizon SDK)
  • XDR fixture pattern — capturing live responses and replaying them in unit tests
  • Coverage thresholds — ≥80 % statements/functions/lines, ≥75 % branches
  • PR checklist for new module methods

Files touched

  • docs/testing-guide.md (new)

Testing

Documentation change — no code modified. Verified all code examples are consistent with the existing test patterns in tests/token.test.ts, tests/helpers/mocks.ts, and the integration test files.

Closes #278

…ios#278)

Adds a comprehensive testing guide covering:
- Unit test setup using createMockClient, createMockServer, createMockKeypair helpers
- Mocking Soroban RPC responses with jest.spyOn and direct server injection
- Testing read methods and write methods with mock servers
- Integration test setup: required env vars, Friendbot account funding
- XDR fixture pattern for capturing and replaying Soroban responses
- Coverage thresholds (≥80% statements/functions/lines, ≥75% branches)
- PR checklist for new module methods

Closes Lead-Studios#278
@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@BashMan11 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

BashMan11 and others added 2 commits July 26, 2026 07:52
…s#279)

Adds @deprecated JSDoc annotations to all patterns identified during source audit:
- buildContractCall(): marks the unused 'server' parameter as deprecated
  (silently ignored; will be removed in 0.3.0 — pass server to simulateTransaction)
- SplitterModule.createRevenueSplit(): deprecated in favour of the generic
  createSplit({ recipients, totalAmount }) which accepts any number of recipients
- RevenueSplitParams interface: deprecated alongside createRevenueSplit();
  callers should use SplitRecipient[] + CreateSplitParams directly
- WatchOptions re-export from './client' in index.ts: removes duplicate export
  (canonical source is types/index.ts; no consumer-facing impact)

Creates docs/deprecated.md cataloguing all deprecated symbols with:
- Deprecated-in / removed-in version numbers (0.2.0 / 0.3.0)
- Migration code examples for each deprecated pattern
- Summary table

Closes Lead-Studios#279
@BigBen-7
BigBen-7 merged commit d95b5b7 into Lead-Studios:main Jul 26, 2026
1 check failed
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.

docs: add docs/testing-guide.md — how to write SDK tests against testnet and mocked RPC

2 participants