Tim Karagosian
07/01/2025, 12:43 PMJonathan
07/01/2025, 1:07 PMAre there ways of testing my View methodsWhat kind of view methods do you have? In an ideal world most of your logic would be in a view model where you can test with without instrumentation. The functionality that requires system components such context, BroadcastReceivers should be abstracted out as much from your Compose (UI) code as possible. Then only that specific functionality could be tested in separately.
Tim Karagosian
07/01/2025, 1:21 PMJonathan
07/01/2025, 1:25 PMTim Karagosian
07/01/2025, 1:33 PMJonathan
07/01/2025, 1:48 PMonTaskResults
). This adds extra complexity but it allows the vm to be in charge. I can verify args as well as determine if navigations is allowed. This will also allow you to navigate based on some internal state. Lastly, its makes testing so much easier but in a generic way. You can verify that clicking buttons correctly trigger a “navigation” in your unit test (non-intrumented).
3. I think the onLogout event should be passed based to the ViewModel for the same reason as above. If for nothing else it, it would make logging your user out based on expired tokens, or remote sign-out event…
Feel free to ignore but MVI has definitely made building apps in Compose easier for me.