MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / recordingFetchSequence

Function recordingFetchSequence

packages/server-e2e/test/client.test.ts:579–590  ·  view source on GitHub ↗
(responseBodies: unknown[], calls: FetchCall[])

Source from the content-addressed store, hash-verified

577}
578
579function recordingFetchSequence(responseBodies: unknown[], calls: FetchCall[]): typeof fetch {
580 let index = 0;
581 return (async (input: Parameters<typeof fetch>[0], init?: Parameters<typeof fetch>[1]) => {
582 calls.push({ url: fetchInputUrl(input), init: init ?? {} });
583 const responseBody = responseBodies[Math.min(index, responseBodies.length - 1)];
584 index++;
585 return new Response(JSON.stringify(responseBody), {
586 status: 200,
587 headers: { 'content-type': 'application/json' },
588 });
589 }) as typeof fetch;
590}
591
592function fetchInputUrl(input: Parameters<typeof fetch>[0]): string {
593 if (typeof input === 'string') return input;

Callers 1

client.test.tsFile · 0.85

Calls 2

fetchInputUrlFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected