MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / fakeTransport

Function fakeTransport

__tests__/explore-session-state.test.ts:411–425  ·  view source on GitHub ↗

Minimal transport: captures the message handler so a test can drive it.

()

Source from the content-addressed store, hash-verified

409describe('sessions sharing a daemon', () => {
410 /** Minimal transport: captures the message handler so a test can drive it. */
411 function fakeTransport(): JsonRpcTransport & { deliver: (m: JsonRpcRequest) => Promise<void>; results: unknown[] } {
412 let handle: ((m: JsonRpcRequest | JsonRpcNotification) => Promise<void>) | null = null;
413 const results: unknown[] = [];
414 return {
415 start(h) { handle = h as typeof handle; },
416 stop() { /* nothing to tear down */ },
417 send() { /* unused */ },
418 notify() { /* unused */ },
419 async request() { return {}; },
420 sendResult(_id, result) { results.push(result); },
421 sendError() { /* unused */ },
422 results,
423 async deliver(m: JsonRpcRequest) { await handle?.(m); },
424 };
425 }
426
427 it('give each session its own state, and one session\'s calls stay there', async () => {
428 const calls: Array<ExploreSessionState | undefined> = [];

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected