MCPcopy Index your code
hub / github.com/simstudioai/sim / mockDb

Function mockDb

apps/sim/lib/logs/execution/logger.test.ts:502–515  ·  view source on GitHub ↗
(billedRows: Array<Record<string, unknown>>)

Source from the content-addressed store, hash-verified

500 // (terminated by .limit), then the already-billed usage_log rows (terminated
501 // by .groupBy). Return each in order.
502 const mockDb = (billedRows: Array<Record<string, unknown>>) => {
503 let call = 0
504 dbSelectMock.mockImplementation(() => {
505 call += 1
506 const rows = call === 1 ? [{ id: 'workflow-1', workspaceId: 'ws-1' }] : billedRows
507 const chain: any = {
508 from: () => chain,
509 where: () => chain,
510 limit: () => Promise.resolve(rows),
511 groupBy: () => Promise.resolve(rows),
512 }
513 return chain
514 })
515 }
516
517 const run = (
518 summary: ReturnType<typeof costSummary>,

Callers 2

runFunction · 0.85
logger.test.tsFile · 0.85

Calls 1

resolveMethod · 0.65

Tested by

no test coverage detected