MCPcopy
hub / github.com/coder/mux / createFakeAIService

Function createFakeAIService

src/node/services/sideQuestionService.test.ts:38–46  ·  view source on GitHub ↗

* Fake AIService for side-question tests. `getStreamInfo` defaults to * "no main-agent stream is in flight" so the side question records no * interruption metadata; callers that want to exercise the split path * override it with a `streamInfo` arg.

(
  model: LanguageModel,
  streamInfo?: ReturnType<AIService["getStreamInfo"]>
)

Source from the content-addressed store, hash-verified

36 * override it with a `streamInfo` arg.
37 */
38function createFakeAIService(
39 model: LanguageModel,
40 streamInfo?: ReturnType<AIService["getStreamInfo"]>
41): SideQuestionAIService {
42 return {
43 createModel: () => Promise.resolve(Ok(model)),
44 getStreamInfo: () => streamInfo,
45 };
46}
47
48/** Fake textStream that emits a fixed sequence of chunks. */
49function fakeTextStream(chunks: readonly string[]) {

Callers 1

Calls 2

OkFunction · 0.90
resolveMethod · 0.80

Tested by

no test coverage detected