MCPcopy
hub / github.com/simstudioai/sim / wireDb

Function wireDb

apps/sim/lib/copilot/tools/server/user/get-credentials.test.ts:43–50  ·  view source on GitHub ↗

* 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 }>)

Source from the content-addressed store, hash-verified

41 * 2. `select({...}).from(user).where().limit(1)` → user row
42 */
43function 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
52describe('getCredentialsServerTool', () => {
53 beforeEach(() => {

Callers 1

Calls 2

resolveMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected