function drainPendingTimers() {
  return act(() => jest.runOnlyPendingTimers());
}
drainPendingTimers just runs pending timers wrapped in act() to avoid
getting warnings from react about side effects that happen async.

This can be used whenever a setTimeout(), setInterval() or async operation is used
which triggers a state update.