Overview
Apps using the SDK have no official way to mock it in unit tests, leading to either real RPC calls in tests or hand-rolled mocks that drift from the real API. Publish an official mock factory.
Acceptance Criteria
@stellar-split/sdk/testing sub-package export with zero production dependencies
createMockSdk(overrides?) returns a fully-typed mock of StellarSplitSDK with jest/vitest spy functions
- Default return values for all read methods (sensible stub
Invoice, LeaderboardEntry[], etc.)
overrides allows partial replacement: createMockSdk({ getInvoice: async () => myInvoice })
mockSdk.getInvoice.mockResolvedValueOnce(...) pattern works (jest-compatible)
- Mock includes
__state helpers: mockSdk.__state.setInvoice(id, invoice) for scenario setup
- Type-safe: TypeScript will error if an override returns the wrong type
- Usage examples in
README.md covering the most common test patterns
Overview
Apps using the SDK have no official way to mock it in unit tests, leading to either real RPC calls in tests or hand-rolled mocks that drift from the real API. Publish an official mock factory.
Acceptance Criteria
@stellar-split/sdk/testingsub-package export with zero production dependenciescreateMockSdk(overrides?)returns a fully-typed mock ofStellarSplitSDKwith jest/vitest spy functionsInvoice,LeaderboardEntry[], etc.)overridesallows partial replacement:createMockSdk({ getInvoice: async () => myInvoice })mockSdk.getInvoice.mockResolvedValueOnce(...)pattern works (jest-compatible)__statehelpers:mockSdk.__state.setInvoice(id, invoice)for scenario setupREADME.mdcovering the most common test patterns