MCPcopy
hub / github.com/afar1/fieldtheory-cli / mockPrompter

Function mockPrompter

tests/possible-wizard.test.ts:26–42  ·  view source on GitHub ↗

* A Prompter that replays a canned queue of answers and captures every line * the wizard writes. Tests push answers in order; step functions consume * them via prompter.ask().

(answers: string[])

Source from the content-addressed store, hash-verified

24 * them via prompter.ask().
25 */
26function mockPrompter(answers: string[]): Prompter & { lines: string[]; remaining: () => number } {
27 const queue = [...answers];
28 const lines: string[] = [];
29 return {
30 ask: async (question: string) => {
31 if (queue.length === 0) {
32 throw new Error(`mockPrompter: ran out of answers at question "${question}"`);
33 }
34 return queue.shift()!;
35 },
36 write: (line: string) => {
37 lines.push(line);
38 },
39 lines,
40 remaining: () => queue.length,
41 };
42}
43
44function fakeSeed(overrides: Partial<IdeasSeed> = {}): IdeasSeed {
45 return {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected