@@ -6252,7 +6252,7 @@ class BrowserTabViewModelTest {
6252
6252
}
6253
6253
6254
6254
@Test
6255
- fun whenOpenDuckChatWithQueryEqualToUrlThenOpenDuckChatWithoutQuery () = runTest {
6255
+ fun whenOpenDuckChatWithQueryEqualToUrlThenOpenDuckChat () = runTest {
6256
6256
val url = " https://example.com"
6257
6257
loadUrl(url)
6258
6258
@@ -6263,7 +6263,7 @@ class BrowserTabViewModelTest {
6263
6263
}
6264
6264
6265
6265
@Test
6266
- fun whenOpenDuckChatWithLastSubmittedQueryThenOpenDuckChatWithQuery () = runTest {
6266
+ fun whenOpenDuckChatWithLastSubmittedUserQueryThenOpenDuckChatWithQuery () = runTest {
6267
6267
val query = " example"
6268
6268
testee.setLastSubmittedUserQuery(query)
6269
6269
@@ -6273,6 +6273,29 @@ class BrowserTabViewModelTest {
6273
6273
verify(mockDuckChat, never()).openDuckChatWithAutoPrompt(any())
6274
6274
}
6275
6275
6276
+ @Test
6277
+ fun whenLastSubmittedUserQueryIsNullAndOmnibarHasTextThenOpenDuckChatWithQuery () = runTest {
6278
+ val query = " example"
6279
+ testee.omnibarViewState.value = omnibarViewState().copy(omnibarText = " foo" )
6280
+
6281
+ testee.openDuckChat(query)
6282
+
6283
+ verify(mockDuckChat).openDuckChat(query)
6284
+ verify(mockDuckChat, never()).openDuckChatWithAutoPrompt(any())
6285
+ }
6286
+
6287
+ @Test
6288
+ fun whenLastSubmittedUserQueryDiffersFromNewQueryThenOpenWithAutoPrompt () = runTest {
6289
+ val query = " example"
6290
+ testee.setLastSubmittedUserQuery(" foo" )
6291
+ testee.omnibarViewState.value = omnibarViewState().copy(omnibarText = " " )
6292
+
6293
+ testee.openDuckChat(query)
6294
+
6295
+ verify(mockDuckChat).openDuckChatWithAutoPrompt(query)
6296
+ verify(mockDuckChat, never()).openDuckChat()
6297
+ }
6298
+
6276
6299
private fun aCredential (): LoginCredentials {
6277
6300
return LoginCredentials (domain = null , username = null , password = null )
6278
6301
}
0 commit comments