Currently, in a lot of our Android apps, our ViewM...
# compose
s
Currently, in a lot of our Android apps, our ViewModels emit sealed data-class instances that closely match the UI (Views), minimizing the code in the UI (Activities, Fragments). These sealed data-classes are very easy to test in plain unit-tests, since they have no dependencies on the Android platform. My question is: Will/does Compose generate instances of classes that are very easy to unit-test as well?
👍 2
r
Which generated instances are you talking about? @Model classes?
s
Yep. The
@Model
classes and maybe even
Compoments
or other variations of a composable functions. Would it be possible to write plain unit tests to inspect/assert/verify those?
r
@Model classes are just data classes (or should be)
For testing in general we have something called Semantics that will also be used for a accessibility and other tasks that require extracting information from the UI (assistants)
l
testing composables should not require any android platform dependencies, so this will be preserved, yes. For testing them, we will be providing some test contexts to compose into and then assert on the result, however if the trees you are producing have android views (as opposed to just compose UI), then you will still have to have an android platform dependency
👍 9
👌 1
s
Thank you, @romainguy and @Leland Richardson [G] !