A fake transaction whose existence query returns the given undeploy ids.
(existingUndeployIds: string[] = [])
| 69 | |
| 70 | /** A fake transaction whose existence query returns the given undeploy ids. */ |
| 71 | function makeTx(existingUndeployIds: string[] = []) { |
| 72 | return { |
| 73 | select: vi.fn(() => ({ |
| 74 | from: vi.fn(() => ({ |
| 75 | where: vi.fn(() => Promise.resolve(existingUndeployIds.map((id) => ({ id })))), |
| 76 | })), |
| 77 | })), |
| 78 | update: vi.fn(() => ({ |
| 79 | set: vi.fn(() => ({ where: vi.fn(() => Promise.resolve(undefined)) })), |
| 80 | })), |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | function setTx(existingUndeployIds: string[] = []) { |
| 85 | vi.mocked(db.transaction).mockImplementation( |
no test coverage detected