Skip to main content
@subsquid/pipes/testing provides utilities for testing pipes end-to-end without hitting a real portal:
  • mockPortal(responses) / finalizedMockPortal(responses): spin up a local HTTP server that plays back scripted portal responses. Both resolve to { url, close() }; pass url as the stream’s portal.
  • readAll(stream): drain a stream into a flat array of data items.
For Solana there are no typed block builders yet; construct portal responses as raw block objects. Each response entry mirrors the portal wire format: a header plus the requested data items (instructions, transactions, etc.).

Example (Vitest)

Mock response types

mockPortal accepts an array of scripted responses, played back in order:
The 409 variant lets you test fork handling deterministically, and 500/503 let you exercise retry behavior.