Unlock This Episode
Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.
This was a lot of work to create this test scheduler, and honestly there may even be a few more subtle bugs lurking in the shadows. Scheduling is an incredibly complex topic, and we have really jumped into the deep end on this episode.
One way to take these ideas further would be to employ some formal methods for verifying scheduling behavior and to check that our test scheduler works correctly. We’ll leave that for another time though.
Now that we’ve got a test scheduler defined and implemented, let’s try to use it to make our view model more testable. Right now we are using
DispatchQueue.main in a few spots in our view model, and as we have seen this is quite a complex dependency to have in our view model, and complicates testing.
An open source library that provides schedulers for making Combine more testable and more versatile.