Open gaslitbytech opened 4 years ago
@tourdownunder in case it's helpful - one trick I like (when the SUT gets input from a stream) is to create a Fake that takes a StreamController in it's constructor, then in the test you can push events into the stream with the controller.
@tourdownunder can we close this issue? I think maybe it was part of #180 ?
To help with unit testing we need to decouple the ConversationsList widget from the Firestore instance. We can just move the Firestore call into the DatabaseService alongside the other Firebase calls then in the widget use the Provider to get the DatabaseService.
In a widget test we can then wrap the ConversationsList widget in a Provider that provides a mocked DatabaseService (that returns a stream with whatever test data we want the widget to receive)