Testing
Both Python and TypeScript SDKs ship a
MockTransport for deterministic unit testing without a live server.MockTransport that records requests and returns canned responses — no server required.
MockTransport
- Python
- TypeScript
Set Responses
- Python
- TypeScript
Assert Requests
- Python
- TypeScript
Reset Between Tests
- Python
- TypeScript
Reset global config
If you modify global config in a test, reset it between tests to avoid cross-test pollution:- Python
- TypeScript
Complete Test Example
- Python
- TypeScript
Testing Streaming
Mock SSE events for testingZabyRuntime.stream():
- Python
- TypeScript
Best Practices
- Reset between tests — Create a fresh
MockTransportper test in both Python and TypeScript. - Assert request paths — Verify the SDK is hitting the correct API endpoint.
- Mock error responses — Test your error handling by returning 4xx/5xx statuses.
- Use async test runners — All SDK methods are async. Mark Python tests with
@pytest.mark.asyncio; useasync/awaitin Vitest for TypeScript.

