mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-19 09:25:34 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/1019 Update unit tests and UI tests
This commit is contained in:
parent
1c543b06bf
commit
3f883d62b7
@ -50,6 +50,7 @@ class SearchFragmentStoreTest {
|
||||
query = "",
|
||||
searchEngineSource = mockk(),
|
||||
defaultEngineSource = mockk(),
|
||||
showSearchSuggestionsHint = false,
|
||||
showSearchSuggestions = false,
|
||||
showSearchShortcuts = false,
|
||||
showClipboardSuggestions = false,
|
||||
|
@ -8,22 +8,33 @@ import android.content.Context
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavDestination
|
||||
import androidx.navigation.NavDirections
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import io.mockk.Runs
|
||||
import io.mockk.every
|
||||
import io.mockk.just
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import io.mockk.mockkObject
|
||||
import mozilla.components.browser.search.SearchEngine
|
||||
import mozilla.components.browser.search.SearchEngineManager
|
||||
import mozilla.components.browser.session.Session
|
||||
import mozilla.components.support.test.robolectric.testContext
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mozilla.fenix.BrowserDirection
|
||||
import org.mozilla.fenix.FenixApplication
|
||||
import org.mozilla.fenix.TestApplication
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.ext.metrics
|
||||
import org.mozilla.fenix.ext.searchEngineManager
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
import org.mozilla.fenix.whatsnew.clear
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@Config(application = TestApplication::class)
|
||||
class SearchInteractorTest {
|
||||
@Test
|
||||
fun onUrlCommitted() {
|
||||
@ -84,11 +95,16 @@ class SearchInteractorTest {
|
||||
@Test
|
||||
fun onTextChanged() {
|
||||
val store: SearchFragmentStore = mockk(relaxed = true)
|
||||
val context: HomeActivity = mockk(relaxed = true)
|
||||
val settings = testContext.settings().apply { testContext.settings().clear() }
|
||||
|
||||
mockkObject(Settings)
|
||||
every { Settings.getInstance(context = context) } returns settings
|
||||
|
||||
every { store.state } returns mockk(relaxed = true)
|
||||
|
||||
val searchController: SearchController = DefaultSearchController(
|
||||
mockk(),
|
||||
context,
|
||||
store,
|
||||
mockk()
|
||||
)
|
||||
@ -97,6 +113,7 @@ class SearchInteractorTest {
|
||||
interactor.onTextChanged("test")
|
||||
|
||||
verify { store.dispatch(SearchFragmentAction.UpdateQuery("test")) }
|
||||
verify { store.dispatch(SearchFragmentAction.ShowSearchSuggestionsHint(false)) }
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user