mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
[fenix] Close https://github.com/mozilla-mobile/fenix/issues/15168: Remove intermittent failing test in ToolbarViewTest
This test seems to be hacking at the binding between Fenix and the
BrowserToolbar to simulate toolbar events passing to the Fenix
interactor.
This is rather clumsy test that relies on the magic working of mockk
instead of following a general unit testing strategy that would commonly
require the class to be re-written to allow for better testing instead.
It is far safer to remove this test since we are not guaranteeing
anything in it and instead we see intermittent failures that make us
lose more time.
So therefore.. 🔥
This commit is contained in:
parent
d32727eff9
commit
632311b1ea
@ -16,11 +16,9 @@ import io.mockk.verify
|
||||
import mozilla.components.browser.toolbar.BrowserToolbar
|
||||
import mozilla.components.browser.toolbar.edit.EditToolbar
|
||||
import mozilla.components.concept.engine.Engine
|
||||
import mozilla.components.concept.toolbar.Toolbar
|
||||
import mozilla.components.support.test.robolectric.testContext
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
@ -68,30 +66,6 @@ class ToolbarViewTest {
|
||||
toolbar = spyk(BrowserToolbar(context))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `sets up interactor listeners`() {
|
||||
lateinit var urlCommitListener: ((String) -> Boolean)
|
||||
var editListener: Toolbar.OnEditListener? = null
|
||||
every { toolbar.setOnUrlCommitListener(any()) } answers {
|
||||
urlCommitListener = firstArg()
|
||||
}
|
||||
every { toolbar.setOnEditListener(any()) } answers {
|
||||
editListener = firstArg()
|
||||
}
|
||||
|
||||
buildToolbarView(isPrivate = false)
|
||||
|
||||
assertFalse(urlCommitListener("test"))
|
||||
verify { interactor.onUrlCommitted("test") }
|
||||
|
||||
assertNotNull(editListener)
|
||||
assertFalse(editListener!!.onCancelEditing())
|
||||
verify { interactor.onEditingCanceled() }
|
||||
|
||||
editListener!!.onTextChanged("https://example.com")
|
||||
verify { interactor.onTextChanged("https://example.com") }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `sets toolbar to normal mode`() {
|
||||
buildToolbarView(isPrivate = false)
|
||||
|
Loading…
Reference in New Issue
Block a user