MCPcopy Create free account
hub / github.com/TestSprite/testsprite-cli / makeAuthFailFetch

Function makeAuthFailFetch

src/commands/init.test.ts:43–61  ·  view source on GitHub ↗

Mock fetch that returns 401 for any request (simulates bad key).

()

Source from the content-addressed store, hash-verified

41
42/** Mock fetch that returns 401 for any request (simulates bad key). */
43function makeAuthFailFetch(): InitDeps['fetchImpl'] {
44 return vi.fn(
45 async () =>
46 new Response(
47 JSON.stringify({
48 error: {
49 code: 'AUTH_INVALID',
50 message: 'Invalid API key',
51 nextAction: 'Provide a valid key.',
52 requestId: 'r-1',
53 },
54 }),
55 {
56 status: 401,
57 headers: { 'content-type': 'application/json' },
58 },
59 ),
60 ) as unknown as InitDeps['fetchImpl'];
61}
62
63// ---------------------------------------------------------------------------
64// In-memory AgentFs

Callers 1

init.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected