(userId: string)
| 7 | |
| 8 | /** Test-only caller bound to a real user row and an optional device session. */ |
| 9 | export 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 | } |
no test coverage detected