* Wires the two sequential `db.select()` reads the tool performs: * 1. `select().from(account).where()` → account rows (awaited directly) * 2. `select({...}).from(user).where().limit(1)` → user row
(accountRows: unknown[], userRows: Array<{ email: string }>)
| 41 | * 2. `select({...}).from(user).where().limit(1)` → user row |
| 42 | */ |
| 43 | function wireDb(accountRows: unknown[], userRows: Array<{ email: string }>) { |
| 44 | const whereThenable = { |
| 45 | then: (resolve: (rows: unknown[]) => unknown) => resolve(accountRows), |
| 46 | limit: () => Promise.resolve(userRows), |
| 47 | } |
| 48 | const builder = { from: () => builder, where: () => whereThenable } |
| 49 | selectMock.mockReturnValue(builder) |
| 50 | } |
| 51 | |
| 52 | describe('getCredentialsServerTool', () => { |
| 53 | beforeEach(() => { |
no test coverage detected