* 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 }
})
| 31 | * last-message lookup that drives dedup — both terminate on `.limit(1)`. |
| 32 | */ |
| 33 | function 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 | |
| 41 | describe('finalizeAssistantTurn', () => { |
| 42 | beforeEach(() => { |
no outgoing calls
no test coverage detected