You mock the clock, advance it, and assert. The assertion runs before the code under test has finished.

async function poll() {

await new Promise((r) => setTimeout(r, 1000))

return 'done'

}