Firebase ID tokens expire after an hour, but are also re generated much sooner than that.
The onIdTokenChanged function is used to handle the new ID token that is generated whenever a user's token has changed for any number of reasons (claims changed, email changed, email verified changed etc.).
You can also revoke the old token by getting the users token with a force refresh: See Docs
I know its not the exact same as testing the expiry, but you can test validity (expired tokens are not valid) by either updating their claims in the emulators auth UI, or forcing a refresh of the token in code.