Overview
Polyglot supports deterministic tests at two main seams.- use fake drivers when you want to bypass HTTP and drive the runtime directly
- use
MockHttpDriverwhen you want to keep transport and provider adapter behavior in play
FakeInferenceDriver
FakeInferenceDriver lives in packages/polyglot/tests/Support.
Use it when you want to test:
Inferencerequest execution without real HTTP- retry and event behavior around raw inference responses
- streaming assembly from queued
PartialInferenceDeltabatches
- queued
InferenceResponseobjects - queued streaming delta batches
- callback-driven sync or streaming behavior when the test needs custom logic
FakeEmbeddingsDriver
FakeEmbeddingsDriver also lives in packages/polyglot/tests/Support.
Use it when you want to test:
EmbeddingsandPendingEmbeddingsbehavior without real HTTP- memoization and runtime delegation
- event dispatch around completed embeddings responses
- queued
EmbeddingsResponseobjects - callback-driven response generation from
EmbeddingsRequest - request recording through
handleCallsandrequests
MockHttpDriver
Use MockHttpDriver when the HTTP layer still matters.
This is the right seam for:
- provider adapter tests
- request body and header assertions
- golden tests around provider-specific payload shapes
- error-path coverage that depends on real HTTP response objects
Which One To Use
Use this rule of thumb:FakeInferenceDriverfor most deterministic inference testsFakeEmbeddingsDriverfor most deterministic embeddings testsMockHttpDriverfor transport and provider adapter coverage