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(
320
320
}
321
321
322
322
override fun openDuckChatSettings () {
323
- // todo what happens with this interaction? closeDuckChat() would go back to browser activity
324
323
val intent = globalActivityStarter.startIntent(context, DuckChatSettingsNoParams )
325
324
intent?.flags = Intent .FLAG_ACTIVITY_NEW_TASK
326
325
context.startActivity(intent)
327
- closeDuckChat()
326
+ appCoroutineScope.launch {
327
+ closeChatFlow.emit(Unit )
328
+ }
328
329
}
329
330
330
331
override fun closeDuckChat () {
Original file line number Diff line number Diff line change @@ -414,6 +414,15 @@ class RealDuckChatTest {
414
414
fun whenOpenDuckChatSettingsCalledThenGlobalActivityStarterCalledWithDuckChatSettings () = runTest {
415
415
whenever(mockGlobalActivityStarter.startIntent(any(), any<ActivityParams >())).thenReturn(Intent ())
416
416
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
+
417
426
testee.openDuckChatSettings()
418
427
419
428
verify(mockGlobalActivityStarter).startIntent(mockContext, DuckChatSettingsNoParams )
@@ -424,7 +433,9 @@ class RealDuckChatTest {
424
433
425
434
assertEquals(Intent .FLAG_ACTIVITY_NEW_TASK , capturedIntent.flags)
426
435
427
- verify(testee).closeDuckChat()
436
+ advanceUntilIdle()
437
+
438
+ assertTrue(onCloseCalled)
428
439
}
429
440
430
441
@Test
You can’t perform that action at this time.
0 commit comments