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

Function mockReads

apps/sim/lib/copilot/chat/terminal-state.test.ts:33–39  ·  view source on GitHub ↗

* Sequence the two in-tx reads: the chat row (`FOR UPDATE ... LIMIT 1`) and the * last-message lookup that drives dedup — both terminate on `.limit(1)`.

(opts: {
  chat: Record<string, unknown> | null
  last?: { messageId: string; role: string }
})

Source from the content-addressed store, hash-verified

31 * last-message lookup that drives dedup — both terminate on `.limit(1)`.
32 */
33function mockReads(opts: {
34 chat: Record<string, unknown> | null
35 last?: { messageId: string; role: string }
36}) {
37 dbChainMockFns.limit.mockResolvedValueOnce(opts.chat ? [opts.chat] : [])
38 dbChainMockFns.limit.mockResolvedValueOnce(opts.last ? [opts.last] : [])
39}
40
41describe('finalizeAssistantTurn', () => {
42 beforeEach(() => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected