|
|
@ -92,6 +92,17 @@ class HistoryMetadataMiddlewareTest {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
fun `GIVEN normal tab has parent WHEN url is the same THEN nothing happens`() {
|
|
|
|
|
|
|
|
val parentTab = createTab("https://mozilla.org", searchTerms = "mozilla website")
|
|
|
|
|
|
|
|
val tab = createTab("https://mozilla.org", parent = parentTab)
|
|
|
|
|
|
|
|
store.dispatch(TabListAction.AddTabAction(parentTab)).joinBlocking()
|
|
|
|
|
|
|
|
store.dispatch(TabListAction.AddTabAction(tab)).joinBlocking()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
store.dispatch(ContentAction.UpdateHistoryStateAction(tab.id, emptyList(), currentIndex = 0)).joinBlocking()
|
|
|
|
|
|
|
|
verify { service wasNot Called }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
fun `GIVEN normal tab has no parent WHEN history metadata is recorded THEN search terms and referrer url are provided`() {
|
|
|
|
fun `GIVEN normal tab has no parent WHEN history metadata is recorded THEN search terms and referrer url are provided`() {
|
|
|
|
val tab = createTab("https://mozilla.org")
|
|
|
|
val tab = createTab("https://mozilla.org")
|
|
|
@ -127,6 +138,41 @@ class HistoryMetadataMiddlewareTest {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
fun `GIVEN normal tab has no parent WHEN history metadata is recorded without search terms THEN no referrer is provided`() {
|
|
|
|
|
|
|
|
val tab = createTab("https://mozilla.org")
|
|
|
|
|
|
|
|
store.dispatch(TabListAction.AddTabAction(tab)).joinBlocking()
|
|
|
|
|
|
|
|
store.dispatch(SearchAction.SetSearchEnginesAction(
|
|
|
|
|
|
|
|
regionSearchEngines = listOf(
|
|
|
|
|
|
|
|
SearchEngine(
|
|
|
|
|
|
|
|
id = "google",
|
|
|
|
|
|
|
|
name = "Google",
|
|
|
|
|
|
|
|
icon = mock(),
|
|
|
|
|
|
|
|
type = SearchEngine.Type.BUNDLED,
|
|
|
|
|
|
|
|
resultUrls = listOf("https://google.com?q={searchTerms}")
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
userSelectedSearchEngineId = null,
|
|
|
|
|
|
|
|
userSelectedSearchEngineName = null,
|
|
|
|
|
|
|
|
regionDefaultSearchEngineId = "google",
|
|
|
|
|
|
|
|
customSearchEngines = emptyList(),
|
|
|
|
|
|
|
|
hiddenSearchEngines = emptyList(),
|
|
|
|
|
|
|
|
additionalAvailableSearchEngines = emptyList(),
|
|
|
|
|
|
|
|
additionalSearchEngines = emptyList(),
|
|
|
|
|
|
|
|
regionSearchEnginesOrder = listOf("google")
|
|
|
|
|
|
|
|
)).joinBlocking()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val historyState = listOf(
|
|
|
|
|
|
|
|
HistoryItem("firefox", "https://mozilla.org"),
|
|
|
|
|
|
|
|
HistoryItem("mozilla", "https://firefox.com")
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
store.dispatch(ContentAction.UpdateHistoryStateAction(tab.id, historyState, currentIndex = 1)).joinBlocking()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
verify {
|
|
|
|
|
|
|
|
service.createMetadata(any(), null, null)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
fun `GIVEN private tab WHEN loading completed THEN no meta data is recorded`() {
|
|
|
|
fun `GIVEN private tab WHEN loading completed THEN no meta data is recorded`() {
|
|
|
|
val tab = createTab("https://mozilla.org", private = true)
|
|
|
|
val tab = createTab("https://mozilla.org", private = true)
|
|
|
|