By mocking the system time and manually progressing it a set amount of time. Otherwise your tests actually take seconds rather than a few milliseconds.
Not a great example, but here is something I did recently that tests time based state (thousands of seconds) but the suite passes in tens of milliseconds.
It also uses a random number generator with a deterministic mode to allow random behaviour in production, but deterministic results in tests (unrelated but also handy)
https://github.com/steveadams/minesweeper-store/blob/main/sr...
Some writing about the repo in case you’re curious: https://steve-adams.me/building-minesweeper-with-xstate-stor...