/** * @jest-environment node */ import { waitForEvmOrUserOpConfirmation } from './waitForEvmOrUserOpConfirmation' describe('waitForEvmOrUserOpConfirmation', () => { beforeEach(() => { jest.useFakeTimers() }) afterEach(() => { jest.useRealTimers() }) it('returns false on timeout when receipt never appears', async () => { const request = jest.fn().mockImplementation(async () => null) const done = waitForEvmOrUserOpConfirmation('0x1', 'eip155:1', request, { pollIntervalMs: 1_000, timeoutMs: 2_500, }) await jest.advanceTimersByTimeAsync(3_100) await expect(done).resolves.toBe(false) expect(request.mock.calls.some((c) => c[0] === 'eth_getTransactionReceipt')).toBe( true, ) }) })