aboutsummaryrefslogtreecommitdiff
path: root/app/src/test/kotlin/com/pitchedapps/frost
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/test/kotlin/com/pitchedapps/frost')
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt2
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/facebook/parsers/FbParseTest.kt19
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/utils/PrefsTest.kt2
3 files changed, 19 insertions, 4 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
index 7e13e6dc..27dd9af9 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
@@ -103,7 +103,7 @@ class FbUrlTest {
@Test
fun video() {
- //note that the video numbers have been changed to maintain privacy
+ // note that the video numbers have been changed to maintain privacy
val url =
"/video_redirect/?src=https%3A%2F%2Fvideo-yyz1-1.xx.fbcdn.net%2Fv%2Ft42.1790-2%2F2349078999904_n.mp4%3Fefg%3DeyJ87J9%26oh%3Df5777784%26oe%3D56FD4&source=media_collage&id=1735049&refid=8&_ft_=qid.6484464%3Amf_story_key.-43172431214%3Atop_level_post_id.102773&__tn__=FEH-R"
val expected =
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 11e2502b..0be29c2b 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
@@ -44,11 +44,17 @@ class FbParseTest {
private inline fun <reified T : ParseData> FrostParser<T>.test(action: T.() -> Unit = {}) =
parse(COOKIE).test(url, action)
- private inline fun <reified T : ParseData> 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")
+ assertFalse(
+ response.data.isEmpty,
+ "${T::class.simpleName} parser returned empty data for $url"
+ )
response.data.action()
}
@@ -77,5 +83,14 @@ class FbParseTest {
assertNotNull(it.img, "img may not be properly matched")
}
notifs.map(FrostNotif::time).assertDescending("notif time values")
+ if (notifs.none { it.unread }) {
+ println("No messages unread.")
+ }
+ notifs.forEach {
+ assertFalse(
+ it.content.startsWith("unread", ignoreCase = true),
+ "Parse error; notif starts with 'Unread'"
+ )
+ }
}
}
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/utils/PrefsTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/utils/PrefsTest.kt
index 088a7fbe..3bac33ac 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/utils/PrefsTest.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/utils/PrefsTest.kt
@@ -25,7 +25,7 @@ import kotlin.test.assertEquals
*/
class PrefsTest {
- //Replicate logic
+ // Replicate logic
var test: Long = -1L
get() {
if (field == -1L) field = file