Imagine, we have a sut as a publisher which publishes values continuously and never finishes. On change of some input (ex: we change some mocked @Published property which our sut depends on), it emits an event.
We're collecting these events in results array and then checking if there is an exact expected number of events, not less and not more.
The problem is - how to check there are no more events after what we expect to be emitted? Without wait method we don't know when it's time to check the results array.
wait will work but it feels for me like a crutch for Combine. Because the good unit tests should be fast (see F.I.R.S.T principles of unit testing). And these waits looks more like anti-pattern.
I also couldn't find an Apple's recommendation on this.
You need a test scheduler, which is basically a virtual time scheduler that will let you control when the time-based events will be published. So for example you can fire all the events at once. Combine does not have build-in a test scheduler, but you can use an open source test scheduler called Entwine