All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonTest.selectable.map.TestSelectableMapViewModel.kt Maven / Gradle / Ivy

Go to download

InstantSearch Android is a library providing widgets and helpers to help you build the best instant-search experience on Android with Algolia. It is built on top of Algolia's Kotlin API Client to provide you a high-level solution to quickly build various search interfaces.

There is a newer version: 3.3.1
Show newest version
package selectable.map

import com.algolia.instantsearch.core.selectable.map.SelectableMapViewModel
import shouldBeNull
import shouldEqual
import kotlin.test.Test

class TestSelectableMapViewModel {

    private val items = mapOf(0 to "A", 1 to "B")

    @Test
    fun noSelectedByDefault() {
        SelectableMapViewModel(items).apply {
            selected.value.shouldBeNull()
        }
    }

    @Test
    fun computeSelected() {
        SelectableMapViewModel(items).apply {
            eventSelection.subscribe { selected.value = it }
            eventSelection.send(1)
            selected.value shouldEqual 1
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy