(afterCallback?: () => never | void)
| 30 | // one microtask (via internal async operations like BEGIN). We simulate this with |
| 31 | // `await Promise.resolve()` to avoid the `txResultPromise` temporal dead zone. |
| 32 | function deferredTransaction(afterCallback?: () => never | void) { |
| 33 | return vi.fn((fn: (tx: any) => Promise<void>) => { |
| 34 | const mockTx = { execute: vi.fn() } |
| 35 | return Promise.resolve() |
| 36 | .then(() => fn(mockTx)) |
| 37 | .then(() => { |
| 38 | afterCallback?.() |
| 39 | }) |
| 40 | }) |
| 41 | } |
| 42 | |
| 43 | test('commit succeeds when conn.transaction() resolves', async () => { |
| 44 | const adapter = createAdapterWithMockConnection(deferredTransaction()) |
no test coverage detected