You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.5 KiB
Kotlin
55 lines
1.5 KiB
Kotlin
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package org.mozilla.fenix.trackingprotectionexceptions
|
|
|
|
import io.mockk.mockk
|
|
import mozilla.components.concept.engine.content.blocking.TrackingProtectionException
|
|
import org.junit.Assert.assertEquals
|
|
import org.junit.Test
|
|
|
|
class ExceptionsInteractorTest {
|
|
|
|
@Test
|
|
fun onLearnMore() {
|
|
var learnMoreClicked = false
|
|
val interactor =
|
|
ExceptionsInteractor(
|
|
{ learnMoreClicked = true },
|
|
mockk(),
|
|
mockk()
|
|
)
|
|
interactor.onLearnMore()
|
|
assertEquals(true, learnMoreClicked)
|
|
}
|
|
|
|
@Test
|
|
fun onDeleteAll() {
|
|
var onDeleteAll = false
|
|
val interactor =
|
|
ExceptionsInteractor(
|
|
mockk(),
|
|
mockk(),
|
|
{ onDeleteAll = true }
|
|
)
|
|
interactor.onDeleteAll()
|
|
assertEquals(true, onDeleteAll)
|
|
}
|
|
|
|
@Test
|
|
fun onDeleteOne() {
|
|
var exceptionsItemReceived: TrackingProtectionException? = null
|
|
val exceptionsItem =
|
|
ExceptionItem("url")
|
|
val interactor =
|
|
ExceptionsInteractor(
|
|
mockk(),
|
|
{ exceptionsItemReceived = exceptionsItem },
|
|
mockk()
|
|
)
|
|
interactor.onDeleteOne(exceptionsItem)
|
|
assertEquals(exceptionsItemReceived, exceptionsItem)
|
|
}
|
|
}
|