Jeferson Boesing

    Jeferson Boesing

    11 months ago
    Can someone provide a code example of how I should unit test my
    ViewModel
    that defines a
    mutableStateOf
    property? I found that
    Snapshot.withMutableSnapshot
    or
    snapshotFlow
    can be used to achieve this, has anyone used this strategy?
    l

    Libor Bicanovsky

    11 months ago
    Is there a reason you're using mutableStateOf inside the view model? I would think that using a kotlin flow such as MutableStateFlow and then collecting as state would be more appropriate. Then for unit testing you can just test it by collecting it or use a library like https://github.com/cashapp/turbine
    Alex Vanyo

    Alex Vanyo

    11 months ago
    j

    julioromano

    10 months ago
    @Jeferson Boesing Could you find any code examples?