MCPcopy Create free account
hub / github.com/bombshell-dev/clack / MockReadable

Class MockReadable

packages/core/test/mock-readable.ts:3–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1import { Readable } from 'node:stream';
2
3export class MockReadable extends Readable {
4 protected _buffer: unknown[] | null = [];
5
6 _read() {
7 if (this._buffer === null) {
8 this.push(null);
9 return;
10 }
11
12 for (const val of this._buffer) {
13 this.push(val);
14 }
15
16 this._buffer = [];
17 }
18
19 pushValue(val: unknown): void {
20 this._buffer?.push(val);
21 }
22
23 close(): void {
24 this._buffer = null;
25 }
26}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected