diff options
author | Allan Wang <me@allanwang.ca> | 2019-09-28 23:53:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-28 23:53:40 -0700 |
commit | 73e16427879908e8b46b7c9fe1e87b0df838fa78 (patch) | |
tree | c3ae5a6890b0797110f397b99812362312c07ff6 /app/src/test | |
parent | 58309cfd62ed26f3cf5d2b1cb933f50078937a3a (diff) | |
parent | f5ae18fc0d824dbdce5523128f9ded86bdfa6d08 (diff) | |
download | frost-73e16427879908e8b46b7c9fe1e87b0df838fa78.tar.gz frost-73e16427879908e8b46b7c9fe1e87b0df838fa78.tar.bz2 frost-73e16427879908e8b46b7c9fe1e87b0df838fa78.zip |
Merge branch 'dev' into desktop-url-convert
Diffstat (limited to 'app/src/test')
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 |