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
5 years ago
|
/* 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/. */
|
||
|
|
||
4 years ago
|
package org.mozilla.fenix.trackingprotectionexceptions
|
||
5 years ago
|
|
||
|
import io.mockk.mockk
|
||
4 years ago
|
import mozilla.components.concept.engine.content.blocking.TrackingProtectionException
|
||
5 years ago
|
import org.junit.Assert.assertEquals
|
||
|
import org.junit.Test
|
||
|
|
||
|
class ExceptionsInteractorTest {
|
||
|
|
||
|
@Test
|
||
|
fun onLearnMore() {
|
||
|
var learnMoreClicked = false
|
||
4 years ago
|
val interactor =
|
||
|
ExceptionsInteractor(
|
||
|
{ learnMoreClicked = true },
|
||
|
mockk(),
|
||
|
mockk()
|
||
|
)
|
||
5 years ago
|
interactor.onLearnMore()
|
||
|
assertEquals(true, learnMoreClicked)
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
fun onDeleteAll() {
|
||
|
var onDeleteAll = false
|
||
4 years ago
|
val interactor =
|
||
|
ExceptionsInteractor(
|
||
|
mockk(),
|
||
|
mockk(),
|
||
|
{ onDeleteAll = true }
|
||
|
)
|
||
5 years ago
|
interactor.onDeleteAll()
|
||
|
assertEquals(true, onDeleteAll)
|
||
|
}
|
||
|
|
||
|
@Test
|
||
|
fun onDeleteOne() {
|
||
4 years ago
|
var exceptionsItemReceived: TrackingProtectionException? = null
|
||
4 years ago
|
val exceptionsItem =
|
||
|
ExceptionItem("url")
|
||
|
val interactor =
|
||
|
ExceptionsInteractor(
|
||
|
mockk(),
|
||
|
{ exceptionsItemReceived = exceptionsItem },
|
||
|
mockk()
|
||
|
)
|
||
5 years ago
|
interactor.onDeleteOne(exceptionsItem)
|
||
|
assertEquals(exceptionsItemReceived, exceptionsItem)
|
||
|
}
|
||
5 years ago
|
}
|