@@ -38,20 +38,26 @@ class RealBrowserMenuHighlightStateTest {
3838
3939 private val downloadMenuStateProvider: DownloadMenuStateProvider = mock()
4040
41+ private val browserMenuDisplayRepository: BrowserMenuDisplayRepository = mock()
42+
4143 private val highlightPopupMenuFlow = MutableStateFlow (false )
4244
4345 private val hasNewDownloadFlow = MutableStateFlow (false )
4446
47+ private val browserMenuStateFlow = MutableStateFlow (BrowserMenuDisplayState (hasOption = false , isEnabled = true ))
48+
4549 private lateinit var testee: RealBrowserMenuHighlightState
4650
4751 @Before
4852 fun setUp () {
4953 whenever(additionalDefaultBrowserPrompts.highlightPopupMenu).thenReturn(highlightPopupMenuFlow)
5054 whenever(downloadMenuStateProvider.hasNewDownloadFlow).thenReturn(hasNewDownloadFlow)
55+ whenever(browserMenuDisplayRepository.browserMenuState).thenReturn(browserMenuStateFlow)
5156
5257 testee = RealBrowserMenuHighlightState (
5358 additionalDefaultBrowserPrompts = additionalDefaultBrowserPrompts,
5459 downloadMenuStateProvider = downloadMenuStateProvider,
60+ browserMenuDisplayRepository = browserMenuDisplayRepository,
5561 appCoroutineScope = coroutineTestRule.testScope,
5662 dispatcherProvider = coroutineTestRule.testDispatcherProvider,
5763 )
@@ -78,7 +84,7 @@ class RealBrowserMenuHighlightStateTest {
7884 }
7985
8086 @Test
81- fun `when new download is true then shouldHighlight is true` () = runTest {
87+ fun `when new download is true and bottom sheet menu enabled then shouldHighlight is true` () = runTest {
8288 testee.shouldHighlight.test {
8389 assertFalse(awaitItem())
8490
@@ -89,6 +95,29 @@ class RealBrowserMenuHighlightStateTest {
8995 }
9096 }
9197
98+ @Test
99+ fun `when new download is true but bottom sheet menu disabled then shouldHighlight is false` () = runTest {
100+ browserMenuStateFlow.value = BrowserMenuDisplayState (hasOption = false , isEnabled = false )
101+
102+ testee = RealBrowserMenuHighlightState (
103+ additionalDefaultBrowserPrompts = additionalDefaultBrowserPrompts,
104+ downloadMenuStateProvider = downloadMenuStateProvider,
105+ browserMenuDisplayRepository = browserMenuDisplayRepository,
106+ appCoroutineScope = coroutineTestRule.testScope,
107+ dispatcherProvider = coroutineTestRule.testDispatcherProvider,
108+ )
109+
110+ testee.shouldHighlight.test {
111+ assertFalse(awaitItem())
112+
113+ hasNewDownloadFlow.value = true
114+ // still false because bottom sheet menu is not enabled
115+ expectNoEvents()
116+
117+ cancelAndIgnoreRemainingEvents()
118+ }
119+ }
120+
92121 @Test
93122 fun `when both sources are true then shouldHighlight is true` () = runTest {
94123 testee.shouldHighlight.test {
0 commit comments