commonTest.searchbox.TestSearchBoxViewModel.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of instantsearch-core Show documentation
Show all versions of instantsearch-core Show documentation
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.
package searchbox
import com.algolia.instantsearch.core.searchbox.SearchBoxViewModel
import shouldEqual
import kotlin.test.Test
class TestSearchBoxViewModel {
@Test
fun setQueryShouldCallSubscription() {
val viewModel = SearchBoxViewModel()
var expected: String? = null
val value = "hello"
viewModel.query.subscribe { expected = it }
viewModel.query.value = value
expected shouldEqual value
}
@Test
fun sendEventShouldCallSubscription() {
val viewModel = SearchBoxViewModel()
var expected: String? = null
val value = "hello"
viewModel.eventSubmit.subscribe { expected = it }
viewModel.eventSubmit.send(value)
expected shouldEqual value
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy