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

Class MockReadable

packages/prompts/test/test-utils.ts:19–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19export class MockReadable extends Readable {
20 protected _buffer: unknown[] | null = [];
21
22 _read() {
23 if (this._buffer === null) {
24 this.push(null);
25 return;
26 }
27
28 for (const val of this._buffer) {
29 this.push(val);
30 }
31
32 this._buffer = [];
33 }
34
35 pushValue(val: unknown): void {
36 this._buffer?.push(val);
37 }
38
39 close(): void {
40 this._buffer = null;
41 }
42}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected