When writing unit test there is a way to wait for asynchronous listener using WorkManager#awaitCompletion.
This is reliable only if PostCommit synchronous listener does not timeout.
Here is a case where it fails:
May be awaitCompletion should be extended to wait for PostCommit listener.
Note that there is a warning when a post commit listener timeout, it should be taken as a bad smell indicator in unit test: