Testing an async stream
A live streaming app's chat ViewModel subscribes to incoming messages as an AsyncSequence and appends them to a list. How would you control that message stream in a test?
A live streaming app's chat ViewModel subscribes to incoming messages as an AsyncSequence and appends them to a list. How would you control that message stream in a test?
Have the ViewModel take the message source as a protocol, pass it a stream made with AsyncStream.makeStream() in tests, and keep the continuation in the test so it calls yield and finish at the moments it chooses and checks how the ViewModel's list changes.
TestingShort answerBasics
An iOS payment app has 90% line coverage, yet payment failure handling regresses every…
#testing
TestingShort answerBasics
A PR fixing a bug in a beauty appointment app got a review comment saying there's no…
#testing
ArchitectureShort answerBasics
Why do we do dependency injection in an iOS app?
#testing
ArchitectureShort answerIntro
When do you use a singleton in an iOS app, and what's the problem with it?
#testing