1
0
mirror of https://github.com/tuskyapp/Tusky synced 2024-12-25 16:23:29 +01:00

add tests

This commit is contained in:
mike castleman 2019-06-01 15:29:33 -04:00
parent b15a5c7614
commit 728e4f4858
No known key found for this signature in database
GPG Key ID: ADB5DCEA7E407AF9

View File

@ -0,0 +1,34 @@
package com.keylesspalace.tusky.util
import android.app.Activity
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.keylesspalace.tusky.FakeTuskyApplication
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
@Config(application = FakeTuskyApplication::class)
@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 {
rollableDomain -> assertTrue(shouldRickRoll(activity, rollableDomain))
}
listOf("chaos.social", "notgab.com").forEach {
notRollableDomain -> assertFalse(shouldRickRoll(activity, notRollableDomain))
}
}
}