aboutsummaryrefslogtreecommitdiff
path: root/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-07-13 13:50:00 -0700
committerGitHub <noreply@github.com>2017-07-13 13:50:00 -0700
commit91119de328bf5f4e8c945f8fb470453319b9f0ed (patch)
tree9ba1786f9cd8488a0cc0dfb247e1b387a4161cfb /app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
parentde34d09f975079d5c044eae6da7ed92605009faf (diff)
downloadfrost-91119de328bf5f4e8c945f8fb470453319b9f0ed.tar.gz
frost-91119de328bf5f4e8c945f8fb470453319b9f0ed.tar.bz2
frost-91119de328bf5f4e8c945f8fb470453319b9f0ed.zip
Dev 1.2.2 - Add framework for messenger notifications (#47)
* Update KAU to v2.0 * Only inject theme for facebook and inject js after * Clean up menu loading logic * Add path null check * Remove .idea files * Add url formatter testers * Update tests and check url nullability - Fixes * Create instant messaging parser * Shorted notification log and remove unnecessary null checks * Make migration buildable * Test message parser * finalize messenger notifs for now
Diffstat (limited to 'app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt')
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt39
1 files changed, 39 insertions, 0 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
new file mode 100644
index 00000000..d7ec4b46
--- /dev/null
+++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
@@ -0,0 +1,39 @@
+package com.pitchedapps.frost.facebook
+
+import org.junit.Test
+import kotlin.test.assertEquals
+
+
+/**
+ * Created by Allan Wang on 2017-07-07.
+ */
+class FbUrlTest {
+
+ @Test
+ fun base() {
+ val url = "https://touch.facebook.com/relative/?asdf=1234&hjkl=7890"
+ assertFbFormat(url, url)
+ }
+
+ @Test
+ fun relative() {
+ val url = "/relative/?asdf=1234&hjkl=7890"
+ assertFbFormat("$FB_URL_BASE${url.substring(1)}", url)
+ }
+
+ @Test
+ fun redirect() {
+ assertFbFormat("$FB_URL_BASE/relative/?asdf=1234&hjkl=7890", "https://touch.facebook.com/l.php?u=$FB_URL_BASE/relative/&asdf=1234&hjkl=7890")
+ }
+
+ @Test fun discard() {
+ val prefix = "$FB_URL_BASE/?test=1234"
+ val suffix = "&apple=notorange"
+ assertFbFormat("$prefix$suffix", "$prefix&ref=hello$suffix")
+ }
+
+ fun assertFbFormat(expected: String, url: String) {
+ val fbUrl = FbUrlFormatter(url)
+ assertEquals(expected, fbUrl.toString(), "FbUrl Mismatch:\n${fbUrl.toLogList().joinToString("\n\t")}")
+ }
+} \ No newline at end of file