Is there a way to configure Realm
so that notifications callbacks (registered with addNotificationBlock
) are fired synchronously? In particular, I want this behavior in tests.
Since the callbacks are asynchronous, they can't be used in tests. Therefore, it's necessary to inject a dependency which wraps notification registration in production, while instead injecting a dependency which mimics the behavior in tests.
That's not a great solution though, since it a) requires much more code and b) that code is making assumptions about Realm, such as how to construct a RealmCollectionChange
.
If it can't be made to fire synchronously, maybe someone has a suggestion for a better way to test code which relies on RealmCollectionChange
?
Aucun commentaire:
Enregistrer un commentaire