MCPcopy Index your code
hub / github.com/TanStack/ai / createFailingMockAdapter

Function createFailingMockAdapter

packages/ai/tests/debug-logging-chat.test.ts:22–31  ·  view source on GitHub ↗

* Create a mock adapter whose chatStream throws once iteration begins. * Exercises the error path through the chat pipeline.

(
  message = 'mock adapter failure',
)

Source from the content-addressed store, hash-verified

20 * Exercises the error path through the chat pipeline.
21 */
22function createFailingMockAdapter(
23 message = 'mock adapter failure',
24): ReturnType<typeof createMockAdapter> {
25 return createMockAdapter({
26 chatStreamFn: () =>
27 (async function* (): AsyncIterable<StreamChunk> {
28 throw new Error(message)
29 })(),
30 })
31}
32
33const logPrefixes = (
34 calls: ReadonlyArray<ReadonlyArray<unknown>>,

Callers 1

Calls 1

createMockAdapterFunction · 0.90

Tested by

no test coverage detected