MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / createTestTRPCContext

Function createTestTRPCContext

apps/web/src/routers/test-utils.ts:9–17  ·  view source on GitHub ↗
(userId: string)

Source from the content-addressed store, hash-verified

7
8/** Test-only caller bound to a real user row and an optional device session. */
9export async function createCallerForUser(userId: string, opts?: { deviceSessionId?: string }) {
10 const user = await findUserById(userId);
11 if (!user) {
12 throw new Error(`Test user not found: ${userId}`);
13 }
14 return createCaller({
15 user,
16 deviceSessionId: opts?.deviceSessionId,
17 headersList: new Headers({ Authorization: `Bearer ${generateApiToken(user)}` }),
18 });
19}

Callers 1

createCallerForUserFunction · 0.85

Calls 1

findUserByIdFunction · 0.90

Tested by

no test coverage detected