How to test Fragments with koinNavGraphViewModel #1275
Unanswered
IonutNegru87
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Due to some issues with migrating to v3 and until the newer version is released I've added the custom extension for
koinNavGraphViewModel
that was mentioned throughout the Issues(before being available in v3).It works ok, except the testing part. I'm unable to mock the vm provided by this one and it crashes as it ends up looking for a NavController (to look into its backstack entry), but It doesn't seem I can provide a valid one for this purpose. The easier and the correct way would be to have a mocked/stub VM just for testing and to not access the NavController (for testing purposes it doesn't even make sense to share the intance).
Is this possible or do I need to update to v3 (is this possible in this version) ?
Beta Was this translation helpful? Give feedback.
All reactions