Swift Testing With Event Streams
The original implementation used XCTestExpectation to do it. […] At first, I thought that I could use Swift Testing’s
confirmationsystem to handle this.[…]
But this had two problems. The obvious one is the nesting. I couldn’t figure out an easy way to avoid it. And in fact, my real code had even more callbacks than this.
The second was about ordering. As far as I can tell, there’s no way for me to distinguish here between “a-b” and “b-a”.
[…]
Eventually, someone else suggested I use an
AsyncStreamto capture events.
Previously: