File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed
duckchat/duckchat-impl/src
main/java/com/duckduckgo/duckchat/impl
test/kotlin/com/duckduckgo/duckchat/impl Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1- VERSION =5.243.0
1+ VERSION =5.243.1
Original file line number Diff line number Diff line change @@ -320,11 +320,12 @@ class RealDuckChat @Inject constructor(
320320 }
321321
322322 override fun openDuckChatSettings () {
323- // todo what happens with this interaction? closeDuckChat() would go back to browser activity
324323 val intent = globalActivityStarter.startIntent(context, DuckChatSettingsNoParams )
325324 intent?.flags = Intent .FLAG_ACTIVITY_NEW_TASK
326325 context.startActivity(intent)
327- closeDuckChat()
326+ appCoroutineScope.launch {
327+ closeChatFlow.emit(Unit )
328+ }
328329 }
329330
330331 override fun closeDuckChat () {
Original file line number Diff line number Diff line change @@ -414,6 +414,15 @@ class RealDuckChatTest {
414414 fun whenOpenDuckChatSettingsCalledThenGlobalActivityStarterCalledWithDuckChatSettings () = runTest {
415415 whenever(mockGlobalActivityStarter.startIntent(any(), any<ActivityParams >())).thenReturn(Intent ())
416416
417+ val testLifecycleOwner = TestLifecycleOwner (initialState = CREATED )
418+
419+ var onCloseCalled = false
420+ testee.observeCloseEvent(testLifecycleOwner) {
421+ onCloseCalled = true
422+ }
423+
424+ testLifecycleOwner.currentState = Lifecycle .State .STARTED
425+
417426 testee.openDuckChatSettings()
418427
419428 verify(mockGlobalActivityStarter).startIntent(mockContext, DuckChatSettingsNoParams )
@@ -424,7 +433,9 @@ class RealDuckChatTest {
424433
425434 assertEquals(Intent .FLAG_ACTIVITY_NEW_TASK , capturedIntent.flags)
426435
427- verify(testee).closeDuckChat()
436+ advanceUntilIdle()
437+
438+ assertTrue(onCloseCalled)
428439 }
429440
430441 @Test
You can’t perform that action at this time.
0 commit comments