diff options
author | Allan Wang <me@allanwang.ca> | 2017-12-26 03:37:32 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-12-26 03:39:28 -0500 |
commit | 1769dbcef9786b847ffeaebdf6ecced45da9222c (patch) | |
tree | 50f543469607b608c0b62ca8a63c6a65325802b9 /app/src/test/kotlin/com/pitchedapps/frost/facebook/FbParseTest.kt | |
parent | 8080d43dbd9a6863fadb86594b179d0919d6215b (diff) | |
download | frost-1769dbcef9786b847ffeaebdf6ecced45da9222c.tar.gz frost-1769dbcef9786b847ffeaebdf6ecced45da9222c.tar.bz2 frost-1769dbcef9786b847ffeaebdf6ecced45da9222c.zip |
Enhancement/fb requests (#575)v1.7.2
* Update lambdas to references
* Simplify regex and parsers
* Fix some parsing and add more tests
* Improve message parser and tests
* Simplify parser
* Shorten interfaces
* Push rem
* Create notification parser
* Clean up notification service
* Clean up notification service
* Add safe cookie fallback
* Fix cookie reference
* Make parsers only hold cookie string
* Clean up cookie references
* Fix up login and event theme
* Update changelog
Remove workspace backup
Diffstat (limited to 'app/src/test/kotlin/com/pitchedapps/frost/facebook/FbParseTest.kt')
-rw-r--r-- | app/src/test/kotlin/com/pitchedapps/frost/facebook/FbParseTest.kt | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbParseTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbParseTest.kt new file mode 100644 index 00000000..65777f97 --- /dev/null +++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbParseTest.kt @@ -0,0 +1,46 @@ +package com.pitchedapps.frost.facebook + +import com.pitchedapps.frost.internal.COOKIE +import com.pitchedapps.frost.internal.assertComponentsNotEmpty +import com.pitchedapps.frost.internal.assertDescending +import com.pitchedapps.frost.internal.authDependent +import com.pitchedapps.frost.parsers.* +import org.junit.BeforeClass +import org.junit.Test +import kotlin.test.fail + +/** + * Created by Allan Wang on 24/12/17. + */ +class FbParseTest { + + companion object { + @BeforeClass + @JvmStatic + fun before() { + authDependent() + } + } + + private inline fun <T : Any> FrostParser<T>.test(action: T.() -> Unit = {}) { + val response = parse(COOKIE) + ?: fail("${this::class.java.simpleName} returned null for $url") + println(response) + response.data.action() + } + + @Test + fun message() = MessageParser.test { + threads.forEach(FrostThread::assertComponentsNotEmpty) + threads.map(FrostThread::time).assertDescending("thread time values") + } + + @Test + fun search() = SearchParser.test() + + @Test + fun notif() = NotifParser.test { + notifs.forEach(FrostNotif::assertComponentsNotEmpty) + notifs.map(FrostNotif::time).assertDescending("notif time values") + } +}
\ No newline at end of file |