aboutsummaryrefslogtreecommitdiff
path: root/app/src/test/kotlin/com/pitchedapps
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-03-31 20:15:03 -0400
committerAllan Wang <me@allanwang.ca>2019-03-31 20:15:03 -0400
commitb464f91668b1985e59b5555450011783da771211 (patch)
tree4b85c9a2725d73f6f5562d8f98fe44170a754f4e /app/src/test/kotlin/com/pitchedapps
parent8f5976ca9a8ca67f24314486b5ecf8cc0f369967 (diff)
downloadfrost-b464f91668b1985e59b5555450011783da771211.tar.gz
frost-b464f91668b1985e59b5555450011783da771211.tar.bz2
frost-b464f91668b1985e59b5555450011783da771211.zip
Add stricter parsing tests
Diffstat (limited to 'app/src/test/kotlin/com/pitchedapps')
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt6
1 files changed, 4 insertions, 2 deletions
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..4fe43ca8 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
@@ -22,6 +22,7 @@ import com.pitchedapps.frost.internal.assertDescending
import com.pitchedapps.frost.internal.authDependent
import org.junit.BeforeClass
import org.junit.Test
+import kotlin.test.assertFalse
import kotlin.test.assertNotNull
import kotlin.test.assertTrue
import kotlin.test.fail
@@ -39,13 +40,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()
}