MCPcopy Index your code
hub / github.com/simstudioai/sim / fakeStreamFactory

Function fakeStreamFactory

apps/sim/providers/streaming-execution.test.ts:13–24  ·  view source on GitHub ↗

* Builds a fake stream factory mirroring the providers' `createReadableStreamFrom*` * helpers: it returns a sentinel stream and synchronously invokes the drain * callback so the test can assert the populated output without a real stream.

(
  drain: (handles: { output: NormalizedBlockOutput; finalizeTiming: () => void }) => void
)

Source from the content-addressed store, hash-verified

11 * callback so the test can assert the populated output without a real stream.
12 */
13function fakeStreamFactory(
14 drain: (handles: { output: NormalizedBlockOutput; finalizeTiming: () => void }) => void
15) {
16 const stream = new ReadableStream()
17 return {
18 stream,
19 createStream: (handles: { output: NormalizedBlockOutput; finalizeTiming: () => void }) => {
20 drain(handles)
21 return stream
22 },
23 }
24}
25
26describe('createStreamingExecution', () => {
27 const providerStartTime = 1_000

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected