2019-06-01 21:29:33 +02:00
|
|
|
package com.keylesspalace.tusky.util
|
|
|
|
|
|
|
|
import android.app.Activity
|
|
|
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
|
|
|
import org.junit.Assert.assertFalse
|
|
|
|
import org.junit.Assert.assertTrue
|
|
|
|
import org.junit.Before
|
|
|
|
import org.junit.Test
|
|
|
|
import org.junit.runner.RunWith
|
|
|
|
import org.robolectric.Robolectric
|
|
|
|
import org.robolectric.annotation.Config
|
|
|
|
|
2020-02-25 19:49:15 +01:00
|
|
|
@Config(sdk = [28])
|
2019-06-01 21:29:33 +02:00
|
|
|
@RunWith(AndroidJUnit4::class)
|
|
|
|
class RickRollTest {
|
|
|
|
private lateinit var activity: Activity
|
|
|
|
@Before
|
|
|
|
fun setupActivity() {
|
|
|
|
val controller = Robolectric.buildActivity(Activity::class.java)
|
|
|
|
activity = controller.get()
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun testShouldRickRoll() {
|
|
|
|
listOf("gab.Com", "social.gab.ai", "whatever.GAB.com").forEach {
|
2021-06-28 21:13:24 +02:00
|
|
|
rollableDomain ->
|
|
|
|
assertTrue(shouldRickRoll(activity, rollableDomain))
|
2019-06-01 21:29:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
listOf("chaos.social", "notgab.com").forEach {
|
2021-06-28 21:13:24 +02:00
|
|
|
notRollableDomain ->
|
|
|
|
assertFalse(shouldRickRoll(activity, notRollableDomain))
|
2019-06-01 21:29:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|