| 851 | |
| 852 | describe('workflow row locking', () => { |
| 853 | function createMissingWorkflowTx() { |
| 854 | const lockFor = vi.fn().mockResolvedValue([]) |
| 855 | const limit = vi.fn(() => ({ for: lockFor })) |
| 856 | const where = vi.fn(() => ({ limit })) |
| 857 | const from = vi.fn(() => ({ where })) |
| 858 | const select = vi.fn(() => ({ from })) |
| 859 | const update = vi.fn() |
| 860 | |
| 861 | return { |
| 862 | tx: { |
| 863 | execute: vi.fn().mockResolvedValue([{ id: mockWorkflowId }]), |
| 864 | select, |
| 865 | update, |
| 866 | }, |
| 867 | lockFor, |
| 868 | update, |
| 869 | } |
| 870 | } |
| 871 | |
| 872 | it('returns not_found when deploy cannot lock a workflow row', async () => { |
| 873 | const { tx, lockFor } = createMissingWorkflowTx() |