aboutsummaryrefslogtreecommitdiff
path: root/app/src/test
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-05-01 16:05:19 -0700
committerAllan Wang <me@allanwang.ca>2019-05-01 16:05:19 -0700
commit58f4f9298b09081b3c937227828824849057a835 (patch)
tree18d2bf44637b52c9f68817253fc37d4ca699daef /app/src/test
parent576cc1a451a16f2d82ee1e41e83c420a85ded47e (diff)
parentda93672c2ed6b54e0e7119a6b55715185112df3e (diff)
downloadfrost-58f4f9298b09081b3c937227828824849057a835.tar.gz
frost-58f4f9298b09081b3c937227828824849057a835.tar.bz2
frost-58f4f9298b09081b3c937227828824849057a835.zip
Merge dev
Diffstat (limited to 'app/src/test')
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/debugger/OfflineWebsiteTest.kt2
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt8
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt5
3 files changed, 10 insertions, 5 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/debugger/OfflineWebsiteTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/debugger/OfflineWebsiteTest.kt
index a2bafba9..0ad60126 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/debugger/OfflineWebsiteTest.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/debugger/OfflineWebsiteTest.kt
@@ -27,9 +27,9 @@ import org.junit.Assume.assumeTrue
import java.io.File
import java.util.zip.ZipFile
import kotlin.test.AfterTest
-import kotlin.test.Test
import kotlin.test.BeforeTest
import kotlin.test.Ignore
+import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt
index 075f045e..11e2502b 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt
@@ -21,7 +21,9 @@ import com.pitchedapps.frost.internal.assertComponentsNotEmpty
import com.pitchedapps.frost.internal.assertDescending
import com.pitchedapps.frost.internal.authDependent
import org.junit.BeforeClass
+import org.junit.Ignore
import org.junit.Test
+import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
import kotlin.test.fail
@@ -39,13 +41,14 @@ class FbParseTest {
}
}
- private inline fun <reified T : Any> FrostParser<T>.test(action: T.() -> Unit = {}) =
+ private inline fun <reified T : ParseData> FrostParser<T>.test(action: T.() -> Unit = {}) =
parse(COOKIE).test(url, action)
- private inline fun <reified T : Any> ParseResponse<T>?.test(url: String, action: T.() -> Unit = {}) {
+ private inline fun <reified T : ParseData> ParseResponse<T>?.test(url: String, action: T.() -> Unit = {}) {
val response = this
?: fail("${T::class.simpleName} parser returned null for $url")
println(response)
+ assertFalse(response.data.isEmpty, "${T::class.simpleName} parser returned empty data for $url")
response.data.action()
}
@@ -62,6 +65,7 @@ class FbParseTest {
@Test
fun messageUser() = MessageParser.queryUser(COOKIE, "allan").test("allan query")
+ @Ignore("No longer works as search results don't appear in html")
@Test
fun search() = SearchParser.test()
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt b/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt
index b8d9635a..41473e86 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/internal/Internal.kt
@@ -59,7 +59,7 @@ val AUTH: RequestAuth by lazy {
}
}
-val VALID_COOKIE: Boolean by lazy {
+private val VALID_COOKIE: Boolean by lazy {
val data = testJsoup(FbItem.SETTINGS.url)
data.title() == "Settings"
}
@@ -68,7 +68,8 @@ fun testJsoup(url: String) = frostJsoup(COOKIE, url)
fun authDependent() {
println("Auth Dependent")
- Assume.assumeTrue(COOKIE.isNotEmpty() && VALID_COOKIE)
+ Assume.assumeTrue("Cookie cannot be empty", COOKIE.isNotEmpty())
+ Assume.assumeTrue("Cookie is not valid", VALID_COOKIE)
}
/**