Skip to content

Commit

Permalink
Issue mozilla-mobile#20864: Speculative fix for HomeFragmentTest fail…
Browse files Browse the repository at this point in the history
…ures
  • Loading branch information
jonalmeida authored and mergify[bot] committed Aug 18, 2021
1 parent 20c9a24 commit ef036f3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/src/test/java/org/mozilla/fenix/home/HomeFragmentTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import mozilla.components.browser.menu.view.MenuButton
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.mozilla.fenix.FenixApplication
import org.mozilla.fenix.ext.application
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.utils.Settings

Expand All @@ -26,13 +29,16 @@ class HomeFragmentTest {

@Before
fun setup() {
context = mockk(relaxed = true)
settings = mockk(relaxed = true)
context = mockk(relaxed = true)

val fenixApplication: FenixApplication = mockk(relaxed = true)

homeFragment = spyk(HomeFragment())

every { context.application } returns fenixApplication
every { homeFragment.context } answers { context }
every { context.settings() } answers { settings }
every { context.components.settings } answers { settings }
}

@Test
Expand All @@ -47,7 +53,7 @@ class HomeFragmentTest {

@Test
fun `GIVEN showTopFrecentSites is true WHEN getTopSitesConfig is called THEN it returns TopSitesConfig with non-null frecencyConfig`() {
every { context.settings().showTopFrecentSites } returns true
every { settings.showTopFrecentSites } returns true
every { settings.topSitesMaxLimit } returns 10

val topSitesConfig = homeFragment.getTopSitesConfig()
Expand Down

0 comments on commit ef036f3

Please sign in to comment.